ignore exit code for pamixer
parent
37e8aa3554
commit
b58336c621
|
@ -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
|
||||
|
|
Loading…
Reference in New Issue