diff options
author | jao <jao@gnu.org> | 2022-05-16 02:53:01 +0100 |
---|---|---|
committer | jao <jao@gnu.org> | 2022-05-16 02:53:01 +0100 |
commit | 289271f1fbbfe8dad4fac812196ba26b281d1876 (patch) | |
tree | 2c475aeba0e3d20f4e13c561c3941f4ea2081e17 /src/Xmobar/Plugins/Monitors | |
parent | 67eb936cea41cfa601053b613e42eb8bb63090f9 (diff) | |
download | xmobar-289271f1fbbfe8dad4fac812196ba26b281d1876.tar.gz xmobar-289271f1fbbfe8dad4fac812196ba26b281d1876.tar.bz2 |
Fix for -W "0" spec in logarithmic bars
Should address issue #630.
Diffstat (limited to 'src/Xmobar/Plugins/Monitors')
-rw-r--r-- | src/Xmobar/Plugins/Monitors/Common/Output.hs | 7 |
1 files changed, 4 insertions, 3 deletions
diff --git a/src/Xmobar/Plugins/Monitors/Common/Output.hs b/src/Xmobar/Plugins/Monitors/Common/Output.hs index 248f276..d87263f 100644 --- a/src/Xmobar/Plugins/Monitors/Common/Output.hs +++ b/src/Xmobar/Plugins/Monitors/Common/Output.hs @@ -3,7 +3,7 @@ ------------------------------------------------------------------------------ -- | -- Module: Xmobar.Plugins.Monitors.Strings --- Copyright: (c) 2018, 2019, 2020 Jose Antonio Ortega Ruiz +-- Copyright: (c) 2018, 2019, 2020, 2022 Jose Antonio Ortega Ruiz -- License: BSD3-style (see LICENSE) -- -- Maintainer: jao@gnu.org @@ -261,9 +261,10 @@ logScaling f v = do l <- fromIntegral `fmap` getConfigValue low bw <- fromIntegral `fmap` getConfigValue barWidth let [ll, hh] = sort [l, h] + bw' = if bw > 0 then bw else 10 scaled x | x == 0.0 = 0 - | x <= ll = 1 / bw - | otherwise = f + logBase 2 (x / hh) / bw + | x <= ll = 1 / bw' + | otherwise = f + logBase 2 (x / hh) / bw' return $ scaled v showLogBar :: Float -> Float -> Monitor String |