From 2a43aae25b980bf08fd0b50c9517f9f72eb94f93 Mon Sep 17 00:00:00 2001 From: Eric Mrak Date: Sat, 15 Mar 2014 19:36:56 -0700 Subject: DiskU/DiskIO have vbar equivalents --- readme.md | 9 ++++++--- src/Plugins/Monitors/Disk.hs | 15 ++++++++++----- 2 files changed, 16 insertions(+), 8 deletions(-) diff --git a/readme.md b/readme.md index 47ccf9c..c532529 100644 --- a/readme.md +++ b/readme.md @@ -840,8 +840,9 @@ more than one battery. - Aliases to `disku` - Disks: list of pairs of the form (device or mount point, template), where the template can contain ``, ``, ``, `` or - ``, `` or `` for total, free, used, free - percentage and used percentage of the given file system capacity. + ``, ``, ``, `` or `` for total, + free, used, free percentage and used percentage of the given file system + capacity. - Args: default monitor arguments. `-t`/`--template` is ignored. - Default template: none (you must specify a template for each file system). - Example: @@ -855,7 +856,9 @@ more than one battery. - Aliases to `diskio` - Disks: list of pairs of the form (device or mount point, template), where the template can contain ``, ``, `` for total, - read and write speed, respectively. + read and write speed, respectively. There are also bar versions of each: + ``, ``, ``, ``, ``, and + ``. - Args: default monitor arguments. `-t`/`--template` is ignored. - Default template: none (you must specify a template for each file system). - Example: diff --git a/src/Plugins/Monitors/Disk.hs b/src/Plugins/Monitors/Disk.hs index cf4fa00..e0a7886 100644 --- a/src/Plugins/Monitors/Disk.hs +++ b/src/Plugins/Monitors/Disk.hs @@ -27,12 +27,14 @@ import Data.Maybe (catMaybes) import System.Directory (canonicalizePath, doesFileExist) diskIOConfig :: IO MConfig -diskIOConfig = mkMConfig "" ["total", "read", "write", - "totalbar", "readbar", "writebar"] +diskIOConfig = mkMConfig "" ["total", "read", "write" + ,"totalbar", "readbar", "writebar" + ,"totalvbar", "readvbar", "writevbar" + ] diskUConfig :: IO MConfig diskUConfig = mkMConfig "" - ["size", "free", "used", "freep", "usedp", "freebar", "usedbar"] + ["size", "free", "used", "freep", "usedp", "freebar", "freevbar", "usedbar", "usedvbar"] type DevName = String type Path = String @@ -129,8 +131,9 @@ runDiskIO' :: (String, [Float]) -> Monitor String runDiskIO' (tmp, xs) = do s <- mapM (showWithColors speedToStr) xs b <- mapM (showLogBar 0.8) xs + vb <- mapM (showLogVBar 0.8) xs setConfigValue tmp template - parseTemplate $ s ++ b + parseTemplate $ s ++ b ++ vb runDiskIO :: DevDataRef -> [(String, String)] -> [String] -> Monitor String runDiskIO dref disks _ = do @@ -167,8 +170,10 @@ runDiskU' tmp path = do s <- zipWithM showWithColors' strs [100, 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) - parseTemplate $ s ++ sp ++ [fb, ub] + uvb <- showVerticalBar (fromIntegral $ 100 - freep) (1 - fr) + parseTemplate $ s ++ sp ++ [fb,fvb,ub,uvb] where ign = const (return [0, 0, 0]) :: SomeException -> IO [Integer] -- cgit v1.2.3