Skip to content

Instantly share code, notes, and snippets.

@matoken
Last active October 11, 2015 10:09
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save matoken/16f6841cdbf79e51b718 to your computer and use it in GitHub Desktop.
Save matoken/16f6841cdbf79e51b718 to your computer and use it in GitHub Desktop.
#!/bin/bash
MUTE=`amixer -c 0 get Master|tail -1|cut -d '[' -f 4|sed s/\]//`
if [ $MUTE = "on" ] ; then
ICON="/usr/share/icons/ContrastHigh/scalable/status/audio-volume-medium.svg"
else
ICON="/usr/share/icons/ContrastHigh/scalable/status/audio-volume-muted.svg"
fi
case "$1" in
"XF86AudioMute" )
if [ $MUTE = "on" ] ; then
amixer -q -c 0 set Master mute
xset -b
echo -e "🔊☓\nmute!"
notify-send -u low -t 500 -i '/usr/share/icons/ContrastHigh/scalable/status/audio-volume-muted.svg' mute "☓"
else
amixer -q -c 0 set Master unmute
amixer -q -c 0 set Speaker unmute
amixer -q -c 0 set Headphone unmute
xset b
echo -e "🔊\nunmute!"
amixer -c 0 get Master | tail -1 | cut -d '[' -f 2 | sed s/\]// | xargs notify-send -u low -t 500 -i '/usr/share/icons/ContrastHigh/scalable/status/audio-volume-high.svg' numute
fi
;;
"XF86AudioRaiseVolume" )
amixer -c 0 set Master 2dB+ | tail -1 | cut -d '[' -f 2 | sed s/\]// | xargs notify-send -u low -t 500 -i $ICON "Vol ⤴"
;;
"XF86AudioLowerVolume" )
amixer -c 0 set Master 2dB- | tail -1 | cut -d '[' -f 2 | sed s/\]// | xargs notify-send -u low -t 500 -i $ICON "Vol ⤵"
;;
esac
@matoken
Copy link
Author

matoken commented Sep 2, 2015

~/.config/awesome/rc.lua

    awful.key({         }, "XF86AudioMute", function () awful.util.spawn("/home/mk/script/awesome-audio.bash XF86AudioMute",false)       end),
    awful.key({         }, "XF86AudioRaiseVolume", function () awful.util.spawn("/home/mk/script/awesome-audio.bash XF86AudioRaiseVolume",false) end),
    awful.key({         }, "XF86AudioLowerVolume", function () awful.util.spawn("/home/mk/script/awesome-audio.bash XF86AudioLowerVolume",false) end),

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment