1
0
Fork 0

clean up volume notification

This commit is contained in:
Luca Bilke 2023-02-09 13:13:18 +01:00
parent 225886e4b2
commit 888cd2481c
2 changed files with 12 additions and 8 deletions

View File

@ -4,6 +4,7 @@
width = 370
height = 370
offset = 5x24
gap_size = 4
transparency = 10
font = Monospace 12
format = "<b>%s</b>\n%b"
@ -15,11 +16,16 @@
markup = full
icon_theme = Qogir-dark
icon_path = /usr/share/icons/Qogir-dark/16/panel/
dmenu = /usr/local/bin/dmenu -p dunst
mouse_left = context
middle = close_all
mouse_right = close_current
[urgency_low]
background = "#1a1b26"
foreground = "#c0caf5"
highlight = "#7aa2f7"
history_ignore = true
timeout = 3
[urgency_normal]

View File

@ -9,11 +9,7 @@ pamixer "$@" >/dev/null
# Query amixer for the current volume and whether or not the speaker is muted
volume="$(pamixer --get-volume)"
if [ "$volume" -gt "100" ]; then
urgency="critical"
else
urgency="low"
fi
[ "$volume" -gt "100" ] && highlight="#ff768e" || highlight="#7aa2f7"
if [ "$volume" -gt "70" ]; then
icon="audio-volume-high"
@ -25,10 +21,12 @@ fi
mute="$(pamixer --get-mute)"
if [ "$volume" = 0 ] || [ "$mute" = "true" ]; then
notify-send -a "changeVolume" -i "audio-volume-muted" -u $urgency -h string:x-dunst-stack-tag:$msgTag "Volume muted"
notify-send -a "changeVolume" -i "audio-volume-muted" -u low -h string:x-dunst-stack-tag:$msgTag "Volume muted"
else
notify-send -a "changeVolume" -i "$icon" -u $urgency -h string:x-dunst-stack-tag:$msgTag \
-h int:value:"$volume" "Volume: ${volume}%"
notify-send -a "changeVolume" -i "$icon" -u low "Volume: ${volume}%"\
-h string:x-dunst-stack-tag:$msgTag \
-h int:value:$volume \
-h string:hlcolor:$highlight
fi
# Play the volume changed sound