Skip to content

Instantly share code, notes, and snippets.

@sharpicx
Last active November 22, 2022 09:25
Show Gist options
  • Save sharpicx/f4934e58a26dfd7610f9a218a50b11a8 to your computer and use it in GitHub Desktop.
Save sharpicx/f4934e58a26dfd7610f9a218a50b11a8 to your computer and use it in GitHub Desktop.
pamixer increasing/decreasing volume notification using dunstify or notify-send and canberra-gtk-play used for audio.
#! /bin/bash
# Author: sharpicx
case $1 in
up)
pamixer -i 5
volume="$(pamixer --get-volume)"
dunstify "VOLUME" "Volume get increasing to $volume%" -h int:value:$volume -i audio-volume-high
canberra-gtk-play -i audio-volume-change -d "changevolume"
;;
down)
pamixer -d 5
volume="$(pamixer --get-volume)"
dunstify "VOLUME" "Volume get decreasing to $volume%" -h int:value:$volume -i audio-volume-low
canberra-gtk-play -i audio-volume-change -d "changevolume"
;;
mute)
pamixer -t
muted="$(pamixer --get-mute)"
if $muted ; then
dunstify "VOLUME" "Volume is getting muted!" -i audio-volume-muted-blocking -u low
else
dunstify "VOLUME" "Volume aint muted!" -i audio-volume-high -u low
canberra-gtk-play -i audio-volume-change
fi
;;
esac
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment