dotfiles/Scripts/volume-notif.sh

20 lines
681 B
Bash
Raw Normal View History

2024-10-06 12:08:49 +00:00
#!/bin/bash
# dunst change volume notification
# set varialbe $volume to current volume level
# --get-volume returns two equal values, the awk
# pipe pulls just the first one - both values
# should match unless balance was adjusted
volume=$(pulsemixer --get-volume | awk '{print $1}')
# set variable $muted to current mute setting
muted=$(pulsemixer --get-mute)
if [[ $muted == 1 || $volume == 0 ]]; then
# show muted notification
dunstify -u low -i audio-volume-muted -h string:x-dunst-stack-tag:Volume "Volume Muted"
else
# show volume notification
dunstify -u low -i audio-volume-high -h string:x-dunst-stack-tag:Volume -h int:value:"$volume" "Volume: ${volume}%"
fi