diff options
-rw-r--r-- | src/Plugins/Monitors.hs | 6 | ||||
-rw-r--r-- | src/Plugins/Monitors/Common.hs | 20 | ||||
-rw-r--r-- | src/Plugins/Monitors/Net.hs | 4 |
3 files changed, 16 insertions, 14 deletions
diff --git a/src/Plugins/Monitors.hs b/src/Plugins/Monitors.hs index 9aef386..68ec3de 100644 --- a/src/Plugins/Monitors.hs +++ b/src/Plugins/Monitors.hs @@ -108,15 +108,15 @@ instance Exec Monitors where alias (Cpu _ _) = "cpu" alias (MultiCpu _ _) = "multicpu" alias (Battery _ _) = "battery" - alias (BatteryP _ _ _)= "battery" + alias (BatteryP {})= "battery" alias (BatteryN _ _ _ a)= a alias (Brightness _ _) = "bright" alias (CpuFreq _ _) = "cpufreq" alias (TopProc _ _) = "top" alias (TopMem _ _) = "topmem" alias (CoreTemp _ _) = "coretemp" - alias (DiskU _ _ _) = "disku" - alias (DiskIO _ _ _) = "diskio" + alias (DiskU {}) = "disku" + alias (DiskIO {}) = "diskio" alias (Uptime _ _) = "uptime" alias (CatInt n _ _ _) = "cat" ++ show n #ifdef IWLIB diff --git a/src/Plugins/Monitors/Common.hs b/src/Plugins/Monitors/Common.hs index 1fd09a6..971de16 100644 --- a/src/Plugins/Monitors/Common.hs +++ b/src/Plugins/Monitors/Common.hs @@ -463,15 +463,17 @@ showVerticalBar v x = colorizeString v [convert $ 100 * x] where t = 9600 + (round val `div` 12) showLogBar :: Float -> Float -> Monitor String -showLogBar f v = do - h <- fromIntegral `fmap` getConfigValue high - l <- fromIntegral `fmap` getConfigValue low - bw <- fromIntegral `fmap` getConfigValue barWidth - let [ll, hh] = sort [l, h] - choose x | x == 0.0 = 0 - | x <= ll = 1 / bw - | otherwise = f + logBase 2 (x / hh) / bw - showPercentBar v $ choose v +showLogBar f v = + let intConfig c = fromIntegral `fmap` getConfigValue c + in do + h <- intConfig high + l <- intConfig low + bw <- intConfig barWidth + let [ll, hh] = sort [l, h] + choose x | x == 0.0 = 0 + | x <= ll = 1 / bw + | otherwise = f + logBase 2 (x / hh) / bw + showPercentBar v $ choose v showLogVBar :: Float -> Float -> Monitor String showLogVBar f v = do diff --git a/src/Plugins/Monitors/Net.hs b/src/Plugins/Monitors/Net.hs index 39bdd61..51c760c 100644 --- a/src/Plugins/Monitors/Net.hs +++ b/src/Plugins/Monitors/Net.hs @@ -51,8 +51,8 @@ instance Ord NetDev where compare NA _ = LT compare _ NA = GT compare (NI _) (NI _) = EQ - compare (NI _) (ND _ _ _) = LT - compare (ND _ _ _) (NI _) = GT + compare (NI _) (ND {}) = LT + compare (ND {}) (NI _) = GT compare (ND _ x1 y1) (ND _ x2 y2) = if downcmp /= EQ then downcmp |