Skip to content

Instantly share code, notes, and snippets.

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

This comment has been minimized.

Copy link

@orschiro orschiro commented Aug 15, 2017

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