diff --git a/src/Monitors/Volume.hs b/src/Monitors/Volume.hs index 1fe5175..cf11e52 100644 --- a/src/Monitors/Volume.hs +++ b/src/Monitors/Volume.hs @@ -76,15 +76,20 @@ parseMixerInfo = fmap fmtMixer . matchRegex regex fmtData :: MixerData -> String fmtData = (separator ++ ) . getStatus +readProcessIgnoreCode :: FilePath -> [String] -> String -> IO String +readProcessIgnoreCode cmd args stdin = do + (_,out,_) <- readProcessWithExitCode cmd args stdin + return out + getMute :: String -> IO Bool -getMute cmd = parseMute <$> readProcess cmd ["--get-mute"] "" +getMute cmd = parseMute <$> readProcessIgnoreCode cmd ["--get-mute"] "" where parseMute "true" = True parseMute "false" = False parseMute _ = False getVol :: String -> IO Int -getVol cmd = parseVol <$> readProcess cmd ["--get-volume"] "" +getVol cmd = parseVol <$> readProcessIgnoreCode cmd ["--get-volume"] "" where parseVol x = case readMaybe x of (Just vol) -> vol Nothing -> 0