ignore exit code for pamixer
parent
37e8aa3554
commit
b58336c621
|
@ -76,15 +76,20 @@ parseMixerInfo = fmap fmtMixer . matchRegex regex
|
||||||
fmtData :: MixerData -> String
|
fmtData :: MixerData -> String
|
||||||
fmtData = (separator ++ ) . getStatus
|
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 :: String -> IO Bool
|
||||||
getMute cmd = parseMute <$> readProcess cmd ["--get-mute"] ""
|
getMute cmd = parseMute <$> readProcessIgnoreCode cmd ["--get-mute"] ""
|
||||||
where
|
where
|
||||||
parseMute "true" = True
|
parseMute "true" = True
|
||||||
parseMute "false" = False
|
parseMute "false" = False
|
||||||
parseMute _ = False
|
parseMute _ = False
|
||||||
|
|
||||||
getVol :: String -> IO Int
|
getVol :: String -> IO Int
|
||||||
getVol cmd = parseVol <$> readProcess cmd ["--get-volume"] ""
|
getVol cmd = parseVol <$> readProcessIgnoreCode cmd ["--get-volume"] ""
|
||||||
where
|
where
|
||||||
parseVol x = case readMaybe x of (Just vol) -> vol
|
parseVol x = case readMaybe x of (Just vol) -> vol
|
||||||
Nothing -> 0
|
Nothing -> 0
|
||||||
|
|
Loading…
Reference in New Issue