From 5823b1a2c9a2ef16922b6a74ec1553da19460a0c Mon Sep 17 00:00:00 2001 From: jao Date: Sun, 8 Mar 2015 20:27:36 +0100 Subject: Better error control in Volume monitor --- src/Plugins/Monitors/Volume.hs | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/src/Plugins/Monitors/Volume.hs b/src/Plugins/Monitors/Volume.hs index 8c39b9f..9f33b3e 100644 --- a/src/Plugins/Monitors/Volume.hs +++ b/src/Plugins/Monitors/Volume.hs @@ -154,18 +154,19 @@ runVolume mixerName controlName argv = do liftMonitor Nothing = unavailable liftMonitor (Just m) = m + channel v r = AE.catch (getChannel FrontLeft v) (const $ return $ Just r) + getDB :: Maybe Volume -> IO (Maybe Integer) getDB Nothing = return Nothing - getDB (Just v) = AE.catch (getChannel FrontLeft $ dB v) - (const $ return $ Just 0) + getDB (Just v) = channel (dB v) 0 getVal :: Maybe Volume -> IO (Maybe Integer) getVal Nothing = return Nothing - getVal (Just v) = getChannel FrontLeft $ value v + getVal (Just v) = channel (value v) 0 getSw :: Maybe Switch -> IO (Maybe Bool) getSw Nothing = return Nothing - getSw (Just s) = getChannel FrontLeft s + getSw (Just s) = channel s False getFormatDB :: VolumeOpts -> Maybe Integer -> Monitor String getFormatDB _ Nothing = unavailable -- cgit v1.2.3