summaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
authorEric Mrak <mail@ericmrak.info>2014-03-13 23:43:08 -0700
committerEric Mrak <mail@ericmrak.info>2014-03-13 23:43:08 -0700
commit91f48b568ffd287097fd41a7dca7fce5b9cc48f4 (patch)
tree98ab85984b633793698150e7e66c6bb62e4f4799
parent4e734b02da0eeffa14bf5960e92f4e7dcdac23dd (diff)
downloadxmobar-91f48b568ffd287097fd41a7dca7fce5b9cc48f4.tar.gz
xmobar-91f48b568ffd287097fd41a7dca7fce5b9cc48f4.tar.bz2
Volume module has volumevbar
-rw-r--r--readme.md2
-rw-r--r--src/Plugins/Monitors/Volume.hs9
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: <volume>% <status>`
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>% <status>"
- ["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