Ensure to unmute default sink

This commit is contained in:
gardouille 2021-12-08 11:40:46 +01:00
parent 9d1f420863
commit dcca2aed03
Signed by: gardouille
GPG Key ID: E759BAA22501AF32
1 changed files with 27 additions and 0 deletions

View File

@ -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
}
# }}}