Set description and update rofi command

This commit is contained in:
Jeremy Gardais 2021-12-13 11:55:01 +01:00
parent d72b5e70a9
commit efa62d37c5
Signed by: jegardai
GPG Key ID: E759BAA22501AF32
1 changed files with 7 additions and 18 deletions

View File

@ -1,8 +1,9 @@
#!/bin/sh #!/bin/sh
# Purpose {{{ # Purpose {{{
# This script will … # This script will allow to change default output sink for PulseAudio
# 1. … # 1. Display the current default and all available outputs.
# … # 2. Set the selected output as default.
# 3. Ensure to unmute the new default output.
# #
# 2021-11-27 # 2021-11-27
# }}} # }}}
@ -15,27 +16,21 @@ readonly NBARGS="${#}"
## Export DEBUG for sub-script ## Export DEBUG for sub-script
export DEBUG export DEBUG
# Default values for some vars
readonly MY_VAR_XY_DEFAULT="666"
## Colors ## Colors
readonly PURPLE='\033[1;35m' readonly PURPLE='\033[1;35m'
readonly RED='\033[0;31m' readonly RED='\033[0;31m'
readonly RESET='\033[0m' readonly RESET='\033[0m'
readonly COLOR_DEBUG="${PURPLE}" readonly COLOR_DEBUG="${PURPLE}"
## Rofi colors
readonly BLACK="#000000"
readonly BLUE="#0094cc"
# }}} # }}}
usage() { # {{{ usage() { # {{{
cat <<- EOF cat <<- EOF
usage: $PROGNAME [-d|-h] usage: $PROGNAME [-d|-h]
Try to give a description… Select a new default output sink for PulseAudio and unmute it.
EXAMPLES: EXAMPLES:
- Apply my script to… - Choose new default output.
${PROGNAME} ${PROGNAME}
OPTIONS: OPTIONS:
@ -176,7 +171,7 @@ choose_pulseaudio_sink() { # {{{
debug_message "choose_pulseaudio_sink \ debug_message "choose_pulseaudio_sink \
Display PulseAudio sinks list with rofi to select one." Display PulseAudio sinks list with rofi to select one."
choosen_sink=$(rofi -location 2 -lines 4 -no-auto-select -i -dmenu -p "New output sink for PulseAudio (current: ${pa_current_sink_description:-Not available})" -color-enabled -color-normal "${BLACK},${BLUE},${BLACK},${BLUE},${BLACK}" -color-window "${BLACK},${BLACK}" < "${pa_sink_list_path}") choosen_sink=$(rofi -theme solarized_alternate -location 2 -l 4 -no-auto-select -i -dmenu -p "New output sink for PulseAudio (current: ${pa_current_sink_description:-Not available})" < "${pa_sink_list_path}")
choosen_sink_index=$(printf -- '%s' "${choosen_sink}" | cut --delimiter=" " --field=1) choosen_sink_index=$(printf -- '%s' "${choosen_sink}" | cut --delimiter=" " --field=1)
choosen_sink_description=$(printf -- '%s' "${choosen_sink}" | cut --delimiter=" " --field=2-) choosen_sink_description=$(printf -- '%s' "${choosen_sink}" | cut --delimiter=" " --field=2-)
@ -315,12 +310,6 @@ if [ ! "${NBARGS}" -eq "0" ]; then
## Exit after help informations ## Exit after help informations
exit 0 exit 0
;; ;;
#-v|--var ) ## Define var with given arg
### Move to the next argument
#shift
### Define var
#readonly my_var_xy="${1}"
#;;
* ) ## unknow option * ) ## unknow option
printf '%b\n' "${RED}Invalid option: ${1}${RESET}" printf '%b\n' "${RED}Invalid option: ${1}${RESET}"
printf '%b\n' "---" printf '%b\n' "---"