summaryrefslogtreecommitdiffhomepage
path: root/monitor.hs
diff options
context:
space:
mode:
Diffstat (limited to 'monitor.hs')
-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]