summaryrefslogtreecommitdiffhomepage
path: root/src
diff options
context:
space:
mode:
authorAntoine Eiche <lewo@abesis.fr>2016-01-03 01:11:48 +0100
committerAntoine Eiche <lewo@abesis.fr>2016-01-03 01:12:36 +0100
commit9c2a16fef60934290bb79d3bafc147ddea235a9f (patch)
tree57192715ad8187edc5b962a41985da372191358e /src
parent3978388731dd8fa19c89907ccf01be970de17f76 (diff)
downloadxmobar-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')
-rw-r--r--src/Plugins/Monitors/Volume.hs12
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