add pamixer notification wrapper
This commit is contained in:
parent
8da5265f4d
commit
a20f58ce00
1 changed files with 35 additions and 0 deletions
35
.local/bin/pamixer-notify
Executable file
35
.local/bin/pamixer-notify
Executable file
|
@ -0,0 +1,35 @@
|
|||
#!/bin/sh
|
||||
|
||||
# Arbitrary but unique message tag
|
||||
msgTag="volume"
|
||||
|
||||
# Change the volume using alsa(might differ if you use pulseaudio)
|
||||
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
|
||||
|
||||
if [ "$volume" -gt "70" ]; then
|
||||
icon="audio-volume-high"
|
||||
elif [ "$volume" -gt "30" ]; then
|
||||
icon="audio-volume-medium"
|
||||
elif [ "$volume" -gt "0" ]; then
|
||||
icon="audio-volume-low"
|
||||
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"
|
||||
else
|
||||
notify-send -a "changeVolume" -i "$icon" -u $urgency -h string:x-dunst-stack-tag:$msgTag \
|
||||
-h int:value:"$volume" "Volume: ${volume}%"
|
||||
fi
|
||||
|
||||
# Play the volume changed sound
|
||||
canberra-gtk-play -i audio-volume-change -d "changeVolume"
|
Loading…
Add table
Reference in a new issue