summaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
authorJose Antonio Ortega Ruiz <jao@gnu.org>2010-12-11 01:02:32 +0100
committerJose Antonio Ortega Ruiz <jao@gnu.org>2010-12-11 01:02:32 +0100
commit533d459b70774b3bbdab5dde1fcb442a579b36cc (patch)
tree0a743a433681418973ecb620abaf1d7a1c595127
parentd726f8e31984cd7afc4907615c58082e8049a671 (diff)
downloadxmobar-533d459b70774b3bbdab5dde1fcb442a579b36cc.tar.gz
xmobar-533d459b70774b3bbdab5dde1fcb442a579b36cc.tar.bz2
More sensitive logbars
-rw-r--r--.gitignore4
-rw-r--r--Plugins/Monitors/Common.hs7
-rw-r--r--Plugins/Monitors/Net.hs2
3 files changed, 11 insertions, 2 deletions
diff --git a/.gitignore b/.gitignore
index 178135c..5ac7957 100644
--- a/.gitignore
+++ b/.gitignore
@@ -1 +1,5 @@
/dist/
+/TAGS
+/IWlib.hs
+/StatFS.hs
+/XUtil.hs
diff --git a/Plugins/Monitors/Common.hs b/Plugins/Monitors/Common.hs
index a00cd48..90b2d28 100644
--- a/Plugins/Monitors/Common.hs
+++ b/Plugins/Monitors/Common.hs
@@ -408,8 +408,13 @@ showPercentBar v x = do
showLogBar :: Float -> Float -> Monitor String
showLogBar f v = do
h <- fromIntegral `fmap` getConfigValue high
+ l <- fromIntegral `fmap` getConfigValue low
bw <- fromIntegral `fmap` getConfigValue barWidth
- showPercentBar v $ f + logBase 10 (v / h) / bw
+ 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
-- $threads
diff --git a/Plugins/Monitors/Net.hs b/Plugins/Monitors/Net.hs
index 64e7eaf..b17aa44 100644
--- a/Plugins/Monitors/Net.hs
+++ b/Plugins/Monitors/Net.hs
@@ -64,7 +64,7 @@ netParser =
formatNet :: Float -> Monitor (String, String)
formatNet d = do
- b <- showLogBar 0.6 d
+ b <- showLogBar 0.9 d
x <- showWithColors (showDigits 1) d
return (x, b)