summaryrefslogtreecommitdiffhomepage
path: root/Plugins/Monitors
diff options
context:
space:
mode:
authorKrzysztof Kosciuszkiewicz <k.kosciuszkiewicz@gmail.com>2007-07-12 03:09:11 +0200
committerKrzysztof Kosciuszkiewicz <k.kosciuszkiewicz@gmail.com>2007-07-12 03:09:11 +0200
commit57b8cee954996394d0ba7212819ffe592d2148b4 (patch)
tree20bed578c1b1e06e6574ce26b2ae92ea855db825 /Plugins/Monitors
parenta8653d8712c2d218adf3f70cef7e511060bed695 (diff)
downloadxmobar-57b8cee954996394d0ba7212819ffe592d2148b4.tar.gz
xmobar-57b8cee954996394d0ba7212819ffe592d2148b4.tar.bz2
Allow reverse "high" and "low" thresholds
darcs-hash:20070712010911-ba08c-adf596c43d2f8ad049449dfef96d7e00758baae8.gz
Diffstat (limited to 'Plugins/Monitors')
-rw-r--r--Plugins/Monitors/Common.hs8
1 files changed, 5 insertions, 3 deletions
diff --git a/Plugins/Monitors/Common.hs b/Plugins/Monitors/Common.hs
index 26b6289..8e2703f 100644
--- a/Plugins/Monitors/Common.hs
+++ b/Plugins/Monitors/Common.hs
@@ -51,6 +51,7 @@ import Control.Monad.Reader
import qualified Data.ByteString.Lazy.Char8 as B
import Data.IORef
import qualified Data.Map as Map
+import Data.List
import Numeric
@@ -262,9 +263,10 @@ showWithColors f x =
do h <- getConfigValue high
l <- getConfigValue low
let col = setColor $ f x
- head $ [col highColor | x > fromIntegral h ] ++
- [col normalColor | x > fromIntegral l ] ++
- [col lowColor | True]
+ [ll,hh] = map fromIntegral $ sort [l, h] -- consider high < low
+ head $ [col highColor | x > hh ] ++
+ [col normalColor | x < ll ] ++
+ [col lowColor | True]
-- $threads