Toggle notify-osd notifications, optionally toggle sound
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env bash | |
# notify-toggle.sh | |
# Kamil Slowikowski | |
# May 31, 2014 | |
# | |
# Toggle libnotify notification bubbles that appear in the top-right corner | |
# of your screen. | |
# You can uncomment some lines to mute and unmute sound, too. | |
# | |
# Works on: | |
# Ubuntu 12.04 | |
# Ubuntu 14.04 | |
# | |
# Example: | |
# chmod +x toggle-notify.sh | |
# ./toggle-notify.sh | |
# Disabled notify-osd | |
# | |
# Toggle sound with these commands: | |
# Ubuntu 10.10: amixer set Master toggle | |
# Ubuntu 12.04: amixer -q -D pulse sset Master toggle | |
# Ubuntu 12.10: | |
# mute: amixer set Master togglectl set-sink-mute 0 1 | |
# unmute: pactl set-sink-mute 0 0 | |
# | |
# http://askubuntu.com/questions/26068/how-do-you-mute-from-the-command-line | |
disabled=$HOME/notify-osd-disabled | |
if [ -e $disabled ] | |
then | |
sudo chmod +x /usr/lib/notify-osd/notify-osd | |
rm -f $disabled | |
# Unmute sound. | |
# amixer -q -D pulse sset Master toggle | |
echo "Enabled notify-osd" # and unmuted sound" | |
else | |
sudo chmod -x /usr/lib/notify-osd/notify-osd | |
killall notify-osd 2>/dev/null | |
touch $disabled | |
# Mute sound. | |
# amixer -q -D pulse sset Master toggle | |
echo "Disabled notify-osd" # and muted sound" | |
fi |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
It would be very nice if this could be implemented with a tray icon!