diff options
| author | Eric Mrak <mail@ericmrak.info> | 2014-03-13 20:06:09 -0700 | 
|---|---|---|
| committer | Eric Mrak <mail@ericmrak.info> | 2014-03-13 20:22:19 -0700 | 
| commit | 7457cf578a283264e0c1297eb5a672601aca9a38 (patch) | |
| tree | ab482ae387d56af04a707b961280c6bc223a58b4 /src/Plugins/Monitors | |
| parent | c7667a521264a7f2d397b651f7991664349d6897 (diff) | |
| download | xmobar-7457cf578a283264e0c1297eb5a672601aca9a38.tar.gz xmobar-7457cf578a283264e0c1297eb5a672601aca9a38.tar.bz2 | |
Brightness hbar is now vbar
Diffstat (limited to 'src/Plugins/Monitors')
| -rw-r--r-- | src/Plugins/Monitors/Bright.hs | 16 | 
1 files changed, 2 insertions, 14 deletions
| diff --git a/src/Plugins/Monitors/Bright.hs b/src/Plugins/Monitors/Bright.hs index 0679ab8..023478a 100644 --- a/src/Plugins/Monitors/Bright.hs +++ b/src/Plugins/Monitors/Bright.hs @@ -16,7 +16,6 @@ module Plugins.Monitors.Bright (brightConfig, runBright) where  import Control.Exception (SomeException, handle)  import qualified Data.ByteString.Lazy.Char8 as B -import Data.Char  import System.FilePath ((</>))  import System.Posix.Files (fileExist)  import System.Console.GetOpt @@ -52,7 +51,7 @@ sysDir = "/sys/class/backlight/"  brightConfig :: IO MConfig  brightConfig = mkMConfig "<percent>" -- template -                         ["hbar", "percent", "bar"] -- replacements +                         ["vbar", "percent", "bar"] -- replacements  data Files = Files { fCurr :: String                     , fMax :: String @@ -78,7 +77,7 @@ runBright args = do      NoFiles -> return "hurz"      _ -> fmtPercent c >>= parseTemplate    where fmtPercent :: Float -> Monitor [String] -        fmtPercent c = do r <- showHorizontalBar (100 * c) +        fmtPercent c = do r <- showVerticalBar (100 * c)                            s <- showPercentWithColors c                            t <- showPercentBar (100 * c) c                            return [r,s,t] @@ -92,14 +91,3 @@ readBright files = do    where grab f = handle handler (fmap (read . B.unpack) $ B.readFile f)          handler = const (return 0) :: SomeException -> IO Float -showHorizontalBar :: Float -> Monitor String -showHorizontalBar x = do -  return $ [convert x] -  where convert :: Float -> Char -        convert val -          | t <= 9600 = ' ' -          | t > 9608 = chr 9608 -          | otherwise = chr t -          where -            -- we scale from 0 to 100, we have 8 slots (9 elements), 100/8 = 12 -            t = 9600 + ((round val) `div` 12) | 
