From 91f48b568ffd287097fd41a7dca7fce5b9cc48f4 Mon Sep 17 00:00:00 2001 From: Eric Mrak Date: Thu, 13 Mar 2014 23:43:08 -0700 Subject: Volume module has volumevbar --- readme.md | 2 +- src/Plugins/Monitors/Volume.hs | 9 +++++++-- 2 files changed, 8 insertions(+), 3 deletions(-) diff --git a/readme.md b/readme.md index ac8f08b..03ed872 100644 --- a/readme.md +++ b/readme.md @@ -945,7 +945,7 @@ more than one battery. - `--highd` _number_ High threshold for dB. Defaults to -5.0. - `--lowd` _number_ Low threshold for dB. Defaults to -30.0. - Variables that can be used with the `-t`/`--template` argument: - `volume`, `volumebar`, `dB`, `status` + `volume`, `volumebar`, `volumevbar`, `dB`, `status` - Note that `dB` might only return 0 on your system. This is known to happen on systems with a pulseaudio backend. - Default template: `Vol: % ` diff --git a/src/Plugins/Monitors/Volume.hs b/src/Plugins/Monitors/Volume.hs index 024292f..d7122d1 100644 --- a/src/Plugins/Monitors/Volume.hs +++ b/src/Plugins/Monitors/Volume.hs @@ -24,7 +24,7 @@ import System.Console.GetOpt volumeConfig :: IO MConfig volumeConfig = mkMConfig "Vol: % " - ["volume", "volumebar", "dB","status"] + ["volume", "volumebar", "volumevbar", "dB","status"] data VolumeOpts = VolumeOpts @@ -76,6 +76,10 @@ formatVolBar :: Integer -> Integer -> Integer -> Monitor String formatVolBar lo hi v = showPercentBar (100 * x) x where x = percent v lo hi +formatVolVBar :: Integer -> Integer -> Integer -> Monitor String +formatVolVBar lo hi v = + showVerticalBar (100 * x) where x = percent v lo hi + switchHelper :: VolumeOpts -> (VolumeOpts -> Maybe String) -> (VolumeOpts -> String) @@ -119,9 +123,10 @@ runVolume mixerName controlName argv = do return (lo, hi, val, db, sw) p <- liftMonitor $ liftM3 formatVol lo hi val b <- liftMonitor $ liftM3 formatVolBar lo hi val + v <- liftMonitor $ liftM3 formatVolVBar lo hi val d <- getFormatDB opts db s <- getFormatSwitch opts sw - parseTemplate [p, b, d, s] + parseTemplate [p, b, v, d, s] where -- cgit v1.2.3