scripts: Remove bar animations from vol/brightness

Removed the ascii-art bar animations calculated for e.g. dunst
notifications for the controls of brightness and volume.

The dunst notifications finally have a working bar slider built into
them when invoked with the correct stack option.
This commit is contained in:
Marty Oehme 2021-06-02 23:30:47 +02:00
parent 0b2c6c9b4b
commit 226c4b5f0d
Signed by: Marty
GPG key ID: B7538B8F50A1C800
2 changed files with 78 additions and 84 deletions

View file

@ -21,17 +21,13 @@ get_brightness() {
send_notification() { send_notification() {
icon="preferences-system-brightness-lock" icon="preferences-system-brightness-lock"
brightness=$(get_brightness) brightness=$(get_brightness)
# Make the bar with the special character ─ (it's not dash -)
# https://en.wikipedia.org/wiki/Box-drawing_character
bar=$(seq -s "─" $((brightness / 5)) | sed 's/[0-9]//g')
if type dunstify 1>/dev/null 2>/dev/null; then if type dunstify 1>/dev/null 2>/dev/null; then
notcmd="dunstify -h string:x-dunst-stack-tag:brightness" notcmd="dunstify -h string:x-dunst-stack-tag:brightness"
else else
notcmd="notify-send -h string:x-dunst-stack-tag:brightness" notcmd="notify-send -h string:x-dunst-stack-tag:brightness"
fi fi
$notcmd -a "changeVolume" -u low -i "$icon" \ $notcmd -a "changeVolume" -u low -i "$icon" \
-h int:value:"$brightness" "Brightness: $brightness% -h int:value:"$brightness" "Brightness: $brightness%"
$bar"
} }
case $direction in case $direction in

View file

@ -59,7 +59,6 @@ send_notification() {
fi fi
vol="$(get_volume)" vol="$(get_volume)"
bar=$(seq -s "─" $((vol / 5)) | sed 's/[0-9]//g')
if [ "$vol" -eq 0 ] || [ "$(get_mute)" = "off" ]; then if [ "$vol" -eq 0 ] || [ "$(get_mute)" = "off" ]; then
# Show the sound muted notification # Show the sound muted notification
@ -67,8 +66,7 @@ send_notification() {
else else
# Show the volume notification # Show the volume notification
$notcmd -a "changeVolume" -u low -i audio-volume-high \ $notcmd -a "changeVolume" -u low -i audio-volume-high \
-h int:value:"$vol" "Volume: $vol% -h int:value:"$vol" "Volume: $vol%"
$bar"
fi fi
} }