dotfiles/Scripts/volume-notif.sh
2024-10-06 08:08:49 -04:00

19 lines
681 B
Bash
Executable file

#!/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