From 1b10d6da86fafb1f65f50f7256aa4cb756b5a51c Mon Sep 17 00:00:00 2001 From: Andrea Rossato Date: Tue, 19 Jun 2007 10:07:45 +0200 Subject: some changes to monitor.hs to test xmobar darcs-hash:20070619080745-92444-1d20389363437b9a48afea1eda9eb8a08d4a3f4b.gz --- monitor.hs | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) (limited to 'monitor.hs') 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] -- cgit v1.2.3