summaryrefslogtreecommitdiffhomepage
path: root/Plugins/Monitors
diff options
context:
space:
mode:
authorJose Antonio Ortega Ruiz <jao@gnu.org>2010-12-08 01:38:14 +0100
committerJose Antonio Ortega Ruiz <jao@gnu.org>2010-12-08 01:38:14 +0100
commita615474dc2daa250602262d59bd3daa7d603cc12 (patch)
tree5815a4b4fba629cfea760afdafd20601ce01b341 /Plugins/Monitors
parent180fab582197384f7018543c106e1b641a0700e0 (diff)
downloadxmobar-a615474dc2daa250602262d59bd3daa7d603cc12.tar.gz
xmobar-a615474dc2daa250602262d59bd3daa7d603cc12.tar.bz2
Default to False for the -P option and leave the % to the templates
Diffstat (limited to 'Plugins/Monitors')
-rw-r--r--Plugins/Monitors/Batt.hs2
-rw-r--r--Plugins/Monitors/Common.hs9
-rw-r--r--Plugins/Monitors/Cpu.hs8
-rw-r--r--Plugins/Monitors/Mem.hs2
-rw-r--r--Plugins/Monitors/MultiCpu.hs2
-rw-r--r--Plugins/Monitors/Swap.hs2
6 files changed, 13 insertions, 12 deletions
diff --git a/Plugins/Monitors/Batt.hs b/Plugins/Monitors/Batt.hs
index 16af6da..547dd02 100644
--- a/Plugins/Monitors/Batt.hs
+++ b/Plugins/Monitors/Batt.hs
@@ -23,7 +23,7 @@ data Batt = Batt Float String
battConfig :: IO MConfig
battConfig = mkMConfig
- "Batt: <left>" -- template
+ "Batt: <left>%" -- template
["leftbar", "left", "status"] -- available replacements
type File = (String, String)
diff --git a/Plugins/Monitors/Common.hs b/Plugins/Monitors/Common.hs
index 637dbd9..9f1db3c 100644
--- a/Plugins/Monitors/Common.hs
+++ b/Plugins/Monitors/Common.hs
@@ -130,7 +130,7 @@ mkMConfig tmpl exprts =
bb <- newIORef ":"
bf <- newIORef "#"
bw <- newIORef 10
- up <- newIORef True
+ up <- newIORef False
return $ MC nc l lc h hc t e p mn mx pc pr bb bf bw up
data Opts = HighColor String
@@ -184,7 +184,7 @@ doConfigOptions [] = io $ return ()
doConfigOptions (o:oo) =
do let next = doConfigOptions oo
nz s = let x = read s in max 0 x
- bool s = s == "True"
+ bool = (`elem` ["True", "true", "Yes", "yes", "On", "on"])
case o of
High h -> setConfigValue (read h) high >> next
Low l -> setConfigValue (read l) low >> next
@@ -198,13 +198,14 @@ doConfigOptions (o:oo) =
Width w -> setConfigValue (nz w) minWidth >>
setConfigValue (nz w) maxWidth >> next
PadChars pc -> setConfigValue pc padChars >> next
- PadAlign pa -> setConfigValue (isPrefixOf "r" pa) padRight >> next
+ PadAlign a -> setConfigValue ("r" `isPrefixOf` a) padRight >> next
BarBack bb -> setConfigValue bb barBack >> next
BarFore bf -> setConfigValue bf barFore >> next
BarWidth bw -> setConfigValue (nz bw) barWidth >> next
UsePercent up -> setConfigValue (bool up) usePercent >> next
-runM :: [String] -> IO MConfig -> ([String] -> Monitor String) -> Int -> (String -> IO ()) -> IO ()
+runM :: [String] -> IO MConfig -> ([String] -> Monitor String) -> Int
+ -> (String -> IO ()) -> IO ()
runM args conf action r cb = go
where go = do
c <- conf
diff --git a/Plugins/Monitors/Cpu.hs b/Plugins/Monitors/Cpu.hs
index d94bd0f..78e3ec7 100644
--- a/Plugins/Monitors/Cpu.hs
+++ b/Plugins/Monitors/Cpu.hs
@@ -19,8 +19,8 @@ import qualified Data.ByteString.Lazy.Char8 as B
cpuConfig :: IO MConfig
cpuConfig = mkMConfig
- "Cpu: <total>" -- template
- ["bar","total","user","nice","system","idle"] -- available replacements
+ "Cpu: <total>%"
+ ["bar","total","user","nice","system","idle"]
cpuData :: IO [Float]
cpuData = do s <- B.readFile "/proc/stat"
@@ -28,7 +28,7 @@ cpuData = do s <- B.readFile "/proc/stat"
cpuParser :: B.ByteString -> [Float]
cpuParser =
- map read . map B.unpack . tail . B.words . flip (!!) 0 . B.lines
+ map (read . B.unpack) . tail . B.words . flip (!!) 0 . B.lines
parseCPU :: IO [Float]
parseCPU =
@@ -48,6 +48,6 @@ formatCpu xs = do
runCpu :: [String] -> Monitor String
runCpu _ =
- do c <- io $ parseCPU
+ do c <- io parseCPU
l <- formatCpu c
parseTemplate l
diff --git a/Plugins/Monitors/Mem.hs b/Plugins/Monitors/Mem.hs
index e1ea5de..a55d58e 100644
--- a/Plugins/Monitors/Mem.hs
+++ b/Plugins/Monitors/Mem.hs
@@ -18,7 +18,7 @@ import Plugins.Monitors.Common
memConfig :: IO MConfig
memConfig = mkMConfig
- "Mem: <usedratio> (<cache>M)" -- template
+ "Mem: <usedratio>% (<cache>M)" -- template
["usedbar", "freebar", "usedratio", "total",
"free", "buffer", "cache", "rest", "used"] -- available replacements
diff --git a/Plugins/Monitors/MultiCpu.hs b/Plugins/Monitors/MultiCpu.hs
index 223ff24..069199b 100644
--- a/Plugins/Monitors/MultiCpu.hs
+++ b/Plugins/Monitors/MultiCpu.hs
@@ -20,7 +20,7 @@ import Data.List (isPrefixOf)
multiCpuConfig :: IO MConfig
multiCpuConfig =
- mkMConfig "Cpu: <total>"
+ mkMConfig "Cpu: <total>%"
[ k ++ n | n <- "" : map show [0 :: Int ..]
, k <- ["bar","total","user","nice","system","idle"]]
diff --git a/Plugins/Monitors/Swap.hs b/Plugins/Monitors/Swap.hs
index 8901a2a..d2e6077 100644
--- a/Plugins/Monitors/Swap.hs
+++ b/Plugins/Monitors/Swap.hs
@@ -20,7 +20,7 @@ import qualified Data.ByteString.Lazy.Char8 as B
swapConfig :: IO MConfig
swapConfig = mkMConfig
- "Swap: <usedratio>" -- template
+ "Swap: <usedratio>%" -- template
["usedratio", "total", "used", "free"] -- available replacements
fileMEM :: IO B.ByteString