Skip to content

Instantly share code, notes, and snippets.

@eze-kiel
Last active December 1, 2021 15:10
Show Gist options
  • Save eze-kiel/7171c64f9a5918cc3cad82da444f5b2b to your computer and use it in GitHub Desktop.
Save eze-kiel/7171c64f9a5918cc3cad82da444f5b2b to your computer and use it in GitHub Desktop.
Use dunstify to get notified about volume percentage and mute toggle
# i3 config relevant part
bindsym XF86AudioMute exec --no-startup-id "amixer -q set Master toggle; /path/to/notify-volume-mute.sh"
bindsym XF86AudioRaiseVolume exec --no-startup-id "amixer -q set Master 3%+ unmute; /path/to/notify-volume-set.sh"
bindsym XF86AudioLowerVolume exec --no-startup-id "amixer -q set Master 3%- unmute; /path/to/notify-volume-set.sh"
#!/bin/bash
status=$(amixer sget Master | tail -n 1 | awk '{print $NF}')
if [ "$status" == "[off]" ]; then
dunstify -t 500 -h string:x-dunst-stack-tag:volume Volume "🔇 muted"
else
dunstify -t 500 -h string:x-dunst-stack-tag:volume Volume "🔊 unmuted"
fi
#!/bin/bash
percent=$(awk -F"[][]" '/Left:/ { print $2 }' <(amixer sget Master))
dunstify -t 500 -h string:x-dunst-stack-tag:volume Volume "🔊 $percent"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment