From 00721a6ff57978cf07dcfe4b7369fe26fe938674 Mon Sep 17 00:00:00 2001 From: jao Date: Fri, 5 Sep 2014 01:25:18 +0200 Subject: Fix: not colorizings total size in DiskU (issue #189) --- news.md | 6 ++++++ src/Plugins/Monitors/Disk.hs | 8 ++++---- 2 files changed, 10 insertions(+), 4 deletions(-) diff --git a/news.md b/news.md index bce6f2b..27e2e45 100644 --- a/news.md +++ b/news.md @@ -15,6 +15,12 @@ _New features_ - Icons can now be also xpm files (if xmobar is compiled with `with_xpm`), thanks to Alexander Shabalin. +_Bug fixes_ + + - Not colorizing total disk size in `DiskU` ([issue #189]). + +[issue #189]: https://github.com/jaor/xmobar/issues/89 + ## Version 0.21 (Jul 1, 2014) _New features_ diff --git a/src/Plugins/Monitors/Disk.hs b/src/Plugins/Monitors/Disk.hs index 4cc2865..b43aede 100644 --- a/src/Plugins/Monitors/Disk.hs +++ b/src/Plugins/Monitors/Disk.hs @@ -1,7 +1,7 @@ ----------------------------------------------------------------------------- -- | -- Module : Plugins.Monitors.Disk --- Copyright : (c) 2010, 2011, 2012 Jose A Ortega Ruiz +-- Copyright : (c) 2010, 2011, 2012, 2014 Jose A Ortega Ruiz -- License : BSD-style (see LICENSE) -- -- Maintainer : Jose A Ortega Ruiz @@ -164,16 +164,16 @@ runDiskU' :: String -> String -> Monitor String runDiskU' tmp path = do setConfigValue tmp template [total, free, diff] <- io (handle ign $ fsStats path) - let strs = map sizeToStr [total, free, diff] + let strs = map sizeToStr [free, diff] freep = if total > 0 then free * 100 `div` total else 0 fr = fromIntegral freep / 100 - s <- zipWithM showWithColors' strs [100, freep, 100 - freep] + s <- zipWithM showWithColors' strs [freep, 100 - freep] sp <- showPercentsWithColors [fr, 1 - fr] fb <- showPercentBar (fromIntegral freep) fr fvb <- showVerticalBar (fromIntegral freep) fr ub <- showPercentBar (fromIntegral $ 100 - freep) (1 - fr) uvb <- showVerticalBar (fromIntegral $ 100 - freep) (1 - fr) - parseTemplate $ s ++ sp ++ [fb,fvb,ub,uvb] + parseTemplate $ [sizeToStr total] ++ s ++ sp ++ [fb,fvb,ub,uvb] where ign = const (return [0, 0, 0]) :: SomeException -> IO [Integer] -- cgit v1.2.3