summaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
authorEric Mrak <mail@ericmrak.info>2014-03-15 19:36:56 -0700
committerEric Mrak <mail@ericmrak.info>2014-03-15 19:36:56 -0700
commit2a43aae25b980bf08fd0b50c9517f9f72eb94f93 (patch)
tree51ea46dfca5f085df6d744224dd925c5615bd95d
parent49ab20e6360456f8d8fbcdc931406b5cf7bd0cca (diff)
downloadxmobar-2a43aae25b980bf08fd0b50c9517f9f72eb94f93.tar.gz
xmobar-2a43aae25b980bf08fd0b50c9517f9f72eb94f93.tar.bz2
DiskU/DiskIO have vbar equivalents
-rw-r--r--readme.md9
-rw-r--r--src/Plugins/Monitors/Disk.hs15
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 `<size>`, `<free>`, `<used>`, `<freep>` or
- `<usedp>`, `<freebar>` or `<usedbar>` for total, free, used, free
- percentage and used percentage of the given file system capacity.
+ `<usedp>`, `<freebar>`, `<freevbar>`, `<usedbar>` or `<usedvbar>` 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 `<total>`, `<read>`, `<write>` for total,
- read and write speed, respectively.
+ read and write speed, respectively. There are also bar versions of each:
+ `<totalbar>`, `<totalvbar>`, `<readbar>`, `<readvbar>`, `<writebar>`, and
+ `<writevbar>`.
- 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]