Skip to content

Instantly share code, notes, and snippets.

@slowkow
Last active August 15, 2017 08:18
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 slowkow/daa7d225674778b58196 to your computer and use it in GitHub Desktop.
Save slowkow/daa7d225674778b58196 to your computer and use it in GitHub Desktop.
Toggle notify-osd notifications, optionally toggle sound
#!/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
@orschiro
Copy link

It would be very nice if this could be implemented with a tray icon!

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