summaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
authorjao <jao@gnu.org>2018-12-24 01:45:12 +0000
committerjao <jao@gnu.org>2018-12-24 01:45:58 +0000
commit8ec23ca5f2107187fffbad36510d80a0b4aa5834 (patch)
treeb4dbadcbc9b5ead338b1f9b34cfed918d8289b61
parent641ea157746422523a43374ce8cba0102a5a5082 (diff)
downloadxmobar-8ec23ca5f2107187fffbad36510d80a0b4aa5834.tar.gz
xmobar-8ec23ca5f2107187fffbad36510d80a0b4aa5834.tar.bz2
Upgrade to alsa-mixer 0.3.0 (cf. #372, #373)
-rw-r--r--src/Xmobar/Plugins/Monitors/Volume.hs8
-rw-r--r--xmobar.cabal4
2 files changed, 7 insertions, 5 deletions
diff --git a/src/Xmobar/Plugins/Monitors/Volume.hs b/src/Xmobar/Plugins/Monitors/Volume.hs
index 1d3281c..05c12d1 100644
--- a/src/Xmobar/Plugins/Monitors/Volume.hs
+++ b/src/Xmobar/Plugins/Monitors/Volume.hs
@@ -151,7 +151,7 @@ runVolumeWith opts mixerName controlName = do
val <- getVal $ volumeControl control
db <- getDB $ volumeControl control
sw <- getSw $ switchControl control
- return (lo, hi, val, db, sw))
+ return (fmap toInteger lo, fmap toInteger hi, val, db, sw))
(const $ return (Nothing, Nothing, Nothing, Nothing, Nothing))
volumeControl :: Maybe Control -> Maybe Volume
@@ -171,7 +171,9 @@ runVolumeWith opts mixerName controlName = do
liftMonitor Nothing = unavailable
liftMonitor (Just m) = m
- channel v r = AE.catch (getChannel FrontLeft v) (const $ return $ Just r)
+ channel' v r = AE.catch (getChannel FrontLeft v) (const $ return $ Just r)
+
+ channel v r = channel' v r >>= \x -> return (x >>= Just . toInteger)
getDB :: Maybe Volume -> IO (Maybe Integer)
getDB Nothing = return Nothing
@@ -183,7 +185,7 @@ runVolumeWith opts mixerName controlName = do
getSw :: Maybe Switch -> IO (Maybe Bool)
getSw Nothing = return Nothing
- getSw (Just s) = channel s False
+ getSw (Just s) = channel' s False
getFormatDB :: VolumeOpts -> Maybe Integer -> Monitor String
getFormatDB _ Nothing = unavailable
diff --git a/xmobar.cabal b/xmobar.cabal
index b789a48..7765f08 100644
--- a/xmobar.cabal
+++ b/xmobar.cabal
@@ -223,7 +223,7 @@ library
cpp-options: -DLIBMPD
if flag(with_alsa) || flag(all_extensions)
- build-depends: alsa-mixer > 0.2.0.2 && < 0.3
+ build-depends: alsa-mixer >= 0.3 && < 0.4
build-depends: alsa-core == 0.5.*,
process >= 1.4.3.0
exposed-modules: Xmobar.Plugins.Monitors.Volume
@@ -325,7 +325,7 @@ test-suite XmobarTest
Xmobar.System.Signal
if flag(with_alsa) || flag(all_extensions)
- build-depends: alsa-mixer > 0.2.0.2 && < 0.3,
+ build-depends: alsa-mixer > 0.2.0.2 && < 0.4,
alsa-core == 0.5.*,
process >= 1.4.3.0
other-modules: Xmobar.Plugins.Monitors.Volume