Compare commits

...

4 Commits

Author SHA1 Message Date
bf03eaf01e updated icons 2025-04-25 16:13:52 +02:00
3480fedbac fixed wrong flag 2024-04-12 10:47:16 +02:00
34dd851273 fixed typo in flag 2024-04-12 10:46:27 +02:00
18d0a25fb9 formatted code 2024-04-12 10:46:16 +02:00

View File

@ -25,7 +25,7 @@ VERBOSE=0
CONFIG_PATH="${XDG_CONFIG_HOME:-$HOME/.config}/volumectl/config.ini" CONFIG_PATH="${XDG_CONFIG_HOME:-$HOME/.config}/volumectl/config.ini"
READ_INI_POSSIBLE_PATHS=(\ READ_INI_POSSIBLE_PATHS=(\
"${XDG_LIB_HOME:-$HOME/.local/lib}/read_ini.sh" "${XDG_LIB_HOME:-$HOME/.local/lib}/bash_ini_parser/read_ini.sh" \ "${XDG_LIB_HOME:-$HOME/.local/lib}/read_ini.sh" "${XDG_LIB_HOME:-$HOME/.local/lib}/bash_ini_parser/read_ini.sh" \
) )
## Args ## Args
@ -33,7 +33,7 @@ OPTIONAL_FLAGS=( \
"-v" "--verbose" \ "-v" "--verbose" \
"-c" "--config" \ "-c" "--config" \
"-h" "-?" "--help" \ "-h" "-?" "--help" \
) )
verbose () { verbose () {
[[ $VERBOSE -eq 1 ]] && return 0 || return 1 [[ $VERBOSE -eq 1 ]] && return 0 || return 1
@ -44,18 +44,20 @@ notify () {
muted=$(get_mute) muted=$(get_mute)
if [[ $muted = "true" ]]; then if [[ $muted = "true" ]]; then
icon="audio-volume-muted" icon="audio-volume-muted-symbolic"
elif [[ $volume -eq 0 ]]; then elif [[ $volume -eq 0 ]]; then
icon="audio-volume-low" icon="audio-volume-low-symbolic"
elif [[ $volume -gt 0 ]] && [[ $volume -lt 50 ]]; then elif [[ $volume -gt 0 ]] && [[ $volume -lt 50 ]]; then
icon="audio-volume-medium" icon="audio-volume-medium-symbolic"
elif [[ $volume -ge 50 ]]; then elif [[ $volume -ge 50 ]]; then
icon="audio-volume-high" icon="audio-volume-high-symbolic"
elif [[ $volume -gt 100 ]]; then
icon="audio-volume-overamplified-symbolic"
fi fi
local cmd="dunstify -h int:value:$volume -t $NOTIFICATION_TIMEOUT -h string:x-dunst-stack-tag:volume -i \"$icon\" \"Volume ($volume%)\"" local cmd="dunstify -h int:value:$volume -t $NOTIFICATION_TIMEOUT -h string:x-dunst-stack-tag:volume -i \"$icon\" \"Volume ($volume%)\""
[[ $NOTIFICATION_ENABLED -eq 1 ]] && sh -c "$cmd" [[ $NOTIFICATION_ENABLED -eq 1 ]] && sh -c "$cmd"
# verbose && ( [[ $NOTIFICATION_ENABLED -eq 1 ]] && echo "Notified with \`$cmd\`" || echo "Didn't notify" ) verbose && ( [[ $NOTIFICATION_ENABLED -eq 1 ]] && echo "Notified with \`$cmd\`" || echo "Didn't notify" )
} }
@ -287,11 +289,11 @@ if [[ "${BASH_SOURCE[0]}" == "${0}" ]]; then #if '__name__' == '__main__'
verbose && echo "Detected -s or --set-volume, with argument '$2'" verbose && echo "Detected -s or --set-volume, with argument '$2'"
[[ -z "$2" ]] && echo "Error, missing value to set volume" 1>&2 && exit 1 || volume_set $2 [[ -z "$2" ]] && echo "Error, missing value to set volume" 1>&2 && exit 1 || volume_set $2
;; ;;
-m|--set-mute) -m|--mute)
verbose && echo "Detected -m or --mute" verbose && echo "Detected -m or --mute"
mute mute
;; ;;
-u|--ummute) -u|--unmute)
verbose && echo "Detected -u or --unmute" verbose && echo "Detected -u or --unmute"
unmute unmute
;; ;;
@ -316,4 +318,3 @@ if [[ "${BASH_SOURCE[0]}" == "${0}" ]]; then #if '__name__' == '__main__'
;; ;;
esac esac
fi fi