I would like to toggle the Do Not Disturb in the notification center with a keyboard shortcut.
I am using BetterTouchTool for some extra keyboard shortcuts but it does not support enabling/disabling the notifications in the default options.
It has an option for executing a terminal command so I'm asking here how to enable/disable Do Not Disturb from the terminal?
I found Schedule ‘Do Not Disturb’ In OS X Mountain Lion With Automator and I tried to run the commands but it didn't seem to work.
Best Answer
You can just setup a global keyboard shortcut for it in System Preferences -> Keyboard -> Shortcuts -> Mission Control
Or if you definitely want it from the command line, an applescript to do this (assuming you setup the keyboard shortcut to use cmdshiftoptctrlD.
Note that you still MUST setup a keyboard command in System Preferences for this to work.
Put the below script into a file, say, ~/dnd.applescript
Now you can run
osascript ~/dnd.applescript
from the command line to toggle your DND setting.Screencap: