diff --git a/rofi-pulse-sink.sh b/rofi-pulse-sink.sh index 34db9cc..1754bbd 100755 --- a/rofi-pulse-sink.sh +++ b/rofi-pulse-sink.sh @@ -1,5 +1,6 @@ #!/bin/sh # +# TODO: Unmute selected output sink # Purpose {{{ # This script will … # 1. … @@ -216,6 +217,28 @@ Error with ${RED}pacmd set-default-sink${COLOR_DEBUG} command." return "${return_set_default_pulseaudio_sink}" +} +# }}} +unmute_default_pulseaudio_sink() { # {{{ + + ## Return False by default + return_unmute_default_pulseaudio_sink="1" + + debug_message "unmute_default_pulseaudio_sink − \ +Try to unmute ${RED}@DEFAULT_SINK@${COLOR_DEBUG} for PulseAudio." + + if pactl set-sink-mute @DEFAULT_SINK@ false; then + debug_message "unmute_default_pulseaudio_sink − \ +${RED}@DEFAULT_SINK@${COLOR_DEBUG} for PulseAudio is now unmute." + return_unmute_default_pulseaudio_sink="0" + else + debug_message "unmute_default_pulseaudio_sink − \ +Error with ${RED}pacmd set-sink-mute${COLOR_DEBUG} command." + return_unmute_default_pulseaudio_sink="1" + fi + + return "${return_unmute_default_pulseaudio_sink}" + } # }}} @@ -255,6 +278,10 @@ main() { # {{{ set_default_pulseaudio_sink \ || error_message "Can't set the selected sink (${choosen_sink_description}) as default output sink/device. Please use --debug option." 3 ## }}} + ## Try to unmute the default output sink {{{ + ### OR Exit with error message + unmute_default_pulseaudio_sink \ + || error_message "Can't unmute the selected sink (${choosen_sink_description}). Please use --debug option." 4 } # }}}