~/.xmonad/scripts/volume
#!/bin/bash
VOL=$(amixer sget Master | tail -1 | awk -F"[][%]" '{ print $2 }')
ISMUTED=$(amixer sget Master | tail -1 | awk -F"[][]" '{ print $4 }')
if [ "$1" == "low" ]
then
#amixer -q set Master 3%- unmute
amixer -q -D pulse set Master 2%- unmute
#ICON="/usr/share/icons/Adwaita/16x16/status/audio-volume-low.png"
ICON="/home/nietz/.local/share/icons/Snowy/symbolic/actions/scalable/zoom-out-symbolic.png"
TEXT=$(amixer sget Master | tail -1 | cut -d' ' -f7 | sed 's/\(\[\|\]\)//g')
TEXT=" Level : ""$TEXT"
volnoti-show $VOL
elif [ "$1" == "high" ]
then
#amixer -q set Master 3%+ unmute
amixer -q -D pulse set Master 2%+ unmute
#ICON="/usr/share/icons/Adwaita/16x16/status/audio-volume-high.png"
ICON="/home/nietz/.local/share/icons/Snowy/symbolic/actions/scalable/zoom-in-symbolic.png"
TEXT=$(amixer sget Master | tail -1 | cut -d' ' -f7 | sed 's/\(\[\|\]\)//g')
TEXT=" Level : ""$TEXT"
volnoti-show $VOL
elif [ "$1" == "mute" ]
then
MUTESTATE=$(amixer sget Master | tail -1 | awk -F"[][]" '{ print $4 }')
#amixer -q set Master toggle
amixer -q -D pulse set Master toggle
if [ "$MUTESTATE" = "on" ]; then
#ICON="/usr/share/icons/Adwaita/16x16/status/audio-volume-muted.png"
ICON="/home/nietz/.local/share/icons/Snowy/actions/scalable/player-volume-muted.png"
TEXT=$(amixer sget Master | tail -1 | cut -d' ' -f8 | sed 's/\(\[\|\]\)//g')
TEXT=" muted : ""$TEXT"
volnoti-show -m
fi
if
[ "$MUTESTATE" = "off" ]; then
#ICON="/usr/share/icons/Adwaita/16x16/status/audio-volume-muted.png"
ICON="/home/nietz/.local/share/icons/Snowy/actions/scalable/player-volume.png"
TEXT=$(amixer sget Master | tail -1 | cut -d' ' -f8 | sed 's/\(\[\|\]\)//g')
TEXT=" muted : ""$TEXT"
volnoti-show $VOL
fi
else
echo "Usage volume [low | high | mute]\n"
fi
ID=$(cat /home/nietz/.xmonad/.dunst_volume)
if [ $ID -gt "0" ]
then
dunstify -p -r $ID -i $ICON " Volume" "$TEXT" >/home/nietz/.xmonad/.dunst_volume
else
dunstify -p -i $ICON " Volume" "$TEXT" >/home/nietz/.xmonad/.dunst_volume
fi