clean newline in mute output

Ricard Illa 2021-08-05 09:54:59 +02:00
parent 165195cd96
commit 24a52ffb02
No known key found for this signature in database
GPG Key ID: F69A672B72E54902
1 changed files with 7 additions and 1 deletions

View File

@ -81,8 +81,14 @@ readProcessIgnoreCode cmd args stdin = do
(_,out,_) <- readProcessWithExitCode cmd args stdin
return out
firstWord :: String -> String
firstWord = getFirst . words
where
getFirst (x:_) = x
getFirst [] = ""
getMute :: String -> IO Bool
getMute cmd = parseMute <$> readProcessIgnoreCode cmd ["--get-mute"] ""
getMute cmd = parseMute . firstWord <$> readProcessIgnoreCode cmd ["--get-mute"] ""
where
parseMute "true" = True
parseMute "false" = False