diff options
author | Antoine Eiche <lewo@abesis.fr> | 2016-01-03 01:11:48 +0100 |
---|---|---|
committer | Antoine Eiche <lewo@abesis.fr> | 2016-01-03 01:12:36 +0100 |
commit | 9c2a16fef60934290bb79d3bafc147ddea235a9f (patch) | |
tree | 57192715ad8187edc5b962a41985da372191358e /src/Plugins/Monitors/Volume.hs | |
parent | 3978388731dd8fa19c89907ccf01be970de17f76 (diff) | |
download | xmobar-9c2a16fef60934290bb79d3bafc147ddea235a9f.tar.gz xmobar-9c2a16fef60934290bb79d3bafc147ddea235a9f.tar.bz2 |
volume: allow alsa capture devices to be monitored
For instance, the following command can be used in the configuration
file:
Run Volume "default" "Capture" [] 10
Diffstat (limited to 'src/Plugins/Monitors/Volume.hs')
-rw-r--r-- | src/Plugins/Monitors/Volume.hs | 12 |
1 files changed, 7 insertions, 5 deletions
diff --git a/src/Plugins/Monitors/Volume.hs b/src/Plugins/Monitors/Volume.hs index 338cf64..39697f7 100644 --- a/src/Plugins/Monitors/Volume.hs +++ b/src/Plugins/Monitors/Volume.hs @@ -15,7 +15,7 @@ module Plugins.Monitors.Volume (runVolume, volumeConfig) where import Control.Applicative ((<$>)) -import Control.Monad ( join, liftM2, liftM3, mplus ) +import Control.Monad ( liftM2, liftM3, mplus ) import Data.Traversable (sequenceA) import Plugins.Monitors.Common import Sound.ALSA.Mixer @@ -144,12 +144,14 @@ runVolume mixerName controlName argv = do (const $ return (Nothing, Nothing, Nothing, Nothing, Nothing)) volumeControl :: Maybe Control -> Maybe Volume - volumeControl c = join $ - (playback . volume <$> c) `mplus` (common . volume <$> c) + volumeControl c = (playback . volume =<< c) + `mplus` (capture . volume =<< c) + `mplus` (common . volume =<< c) switchControl :: Maybe Control -> Maybe Switch - switchControl c = join $ - (playback . switch <$> c) `mplus` (common . switch <$> c) + switchControl c = (playback . switch =<< c) + `mplus` (capture . switch =<< c) + `mplus` (common . switch =<< c) liftMaybe :: Maybe (IO (a,b)) -> IO (Maybe a, Maybe b) liftMaybe = fmap (liftM2 (,) (fmap fst) (fmap snd)) . sequenceA |