Shortcut to hide libnotify

Solution 1:

I dont think there is a direct way to disable and re-enable the notifications.

However you could write two scripts which you could have on your desktop or a dock such as awn/docky etc. The scripts would remove the execute permission from the executable that is run to display the notification. You also need to kill the notification process that is running.

one script - lets call it "disableNotify" could have the commands

sudo chmod -x /usr/lib/notify-osd/notify-osd
killall notify-osd

the other script - lets call it "enableNotify" could have the commands

sudo chmod +x /usr/lib/notify-osd/notify-osd

Create each script as a text file in Text Editor

Give the script execute rights i.e.

chmod +x enableNotify
chmod +x disableNotify

The scripts will obviously prompt you for your password since it uses "sudo". There are ways to prevent this but that is perhaps worth another question.

Solution 2:

I made a script with fossfreedom's commands to toggle notify-osd notifications on Ubuntu 12.04. I also show how to bind it to a keyboard shortcut in this answer.