[Linux] Unmute all when no action selected in rofi_select_input.hs

This commit is contained in:
Ivan Malison 2017-04-04 19:45:18 -07:00
parent fb3e63377f
commit 6010a0c2d1
No known key found for this signature in database
GPG Key ID: 62530EFBE99DC2F8

View File

@ -23,6 +23,7 @@ main = do
unMuteSelected = setMuteAction "0" selectedSink unMuteSelected = setMuteAction "0" selectedSink
selectedIsMuted = fromMaybe True $ selectedIsMuted = fromMaybe True $
isMuted . (!! 1) <$> find ((== selectedSink) . head) matches isMuted . (!! 1) <$> find ((== selectedSink) . head) matches
setAll state = mapM_ (setMuteAction state . head) matches
print selectedSink print selectedSink
print matches print matches
print selectedIsMuted print selectedIsMuted
@ -31,9 +32,9 @@ main = do
void $ setMuteAction (toSetString selectedIsMuted) selectedSink void $ setMuteAction (toSetString selectedIsMuted) selectedSink
ExitFailure 10 -> ExitFailure 10 ->
do do
mapM_ (setMuteAction "1" . head) matches setAll "1"
void unMuteSelected void unMuteSelected
ExitFailure _ -> return () ExitFailure _ -> setAll "0"
where getSinkText = do where getSinkText = do
(_, txt, _) <- readCreateProcessWithExitCode (shell "pactl list sink-inputs") "" (_, txt, _) <- readCreateProcessWithExitCode (shell "pactl list sink-inputs") ""
return txt return txt