Skip to content

Instantly share code, notes, and snippets.

@sakhmatd
Created May 24, 2021 09:58
Show Gist options
  • Save sakhmatd/eb838d329e786f8790257a3465f7f235 to your computer and use it in GitHub Desktop.
Save sakhmatd/eb838d329e786f8790257a3465f7f235 to your computer and use it in GitHub Desktop.
Use pamixer and dunst to create a volume indicator for DE-less setups
#!/bin/bash
# dunstMixer
msgId="3378423"
pamixer "$@" > /dev/null
volume="$(pamixer --get-volume)"
mute="$(pamixer --get-mute)"
if [[ $volume == 0 || "$mute" == "true" ]]; then
dunstify -a "changeVolume" -u low -i audio-volume-muted -r "$msgId" "Volume muted"
else
dunstify -a "changeVolume" -u low -i audio-volume-high -r "$msgId" \
-h int:value:"$volume" "Volume: ${volume}%"
fi
canberra-gtk-play -i audio-volume-change -d "changeVolume"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment