summaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
authorAndrea Rossato <andrea.rossatoo@unibz.it>2007-06-19 10:07:45 +0200
committerAndrea Rossato <andrea.rossatoo@unibz.it>2007-06-19 10:07:45 +0200
commit1b10d6da86fafb1f65f50f7256aa4cb756b5a51c (patch)
tree056095402438df8f0a05bc33fe56992e9c0f6dcc
parenta23f5db95e3d4a05a7b4085386a3815d043429df (diff)
downloadxmobar-1b10d6da86fafb1f65f50f7256aa4cb756b5a51c.tar.gz
xmobar-1b10d6da86fafb1f65f50f7256aa4cb756b5a51c.tar.bz2
some changes to monitor.hs to test xmobar
darcs-hash:20070619080745-92444-1d20389363437b9a48afea1eda9eb8a08d4a3f4b.gz
-rwxr-xr-xmonitor.hs8
1 files changed, 6 insertions, 2 deletions
diff --git a/monitor.hs b/monitor.hs
index d6f0e34..7705bc6 100755
--- a/monitor.hs
+++ b/monitor.hs
@@ -20,8 +20,10 @@ memParse file =
rest = free + buffer + cache
used = total - rest
usedratio = used * 100 / total
+ realused = if usedratio > 50 then "^#FF0000"++show used++"^#FFFFFF"
+ else "^#FF00FF"++show used++"^#FFFFFF"
in
- printf "MEM: %sM %.1f%% used %.0fM rest" used usedratio rest
+ printf "MEM: %sM %.1f%% used %.0fM rest" realused usedratio rest
mem :: IO String
@@ -40,7 +42,9 @@ temp :: IO String
temp = do
file <- readFile "/proc/acpi/thermal_zone/THRM/temperature"
let t = (words file) !! 1
- return $ "TEMP: " ++ t ++ "C"
+ f t | read t > 60 = "^#FF0000"++t++"^#FFFFFF"
+ | otherwise = "^#00FF00"++t++"^#FFFFFF"
+ return $ "TEMP: " ++ (f t) ++ "C"
takeTail :: Int -> [a] -> [a]