Create a gist now

Instantly share code, notes, and snippets.

Embed
What would you like to do?
#!/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

This comment has been minimized.

Show comment
Hide comment
@matoken

matoken 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),
Owner

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