Is there a way I can bind a single key on my keyboard to toggle "Do not Disturb"?

It would be more convenient that opening up the notification center and moving that awkward slider.

I do think that you can bind a key to a script, so a command line option for "Do not Disturb" would work as well, so if there is a command-line tool to enable/disable "Do not Disturb" then I will take that as an answer (since I am muy familiar with bash and applescript).

  • 1
    Here is a ruby script that needs you to pass an "on/off" but it uses the correct manner of applescript simulating the mouse actions. Just writing to the plist using bash directly doesn't do everything the UI does on 10.11, so I don't use defaults write to make this change directly anymore - gist.github.com/samnung/c7e767167cf70531ccdc – bmike Nov 17 '15 at 16:18

Hold down the Option key and click on the Notifications icon in the menu bar.

  • That's great, but I'm looking for a single key to do this without the mouse. – Daniel Jan 27 '16 at 1:58
  • Go to System Preferences>Keyboard and select Mission Control. Tick the Do Not Disturb On/Off box then add your own button combination. Mine is Control Shift D. Granted its not a single button shortcut, but you don't have to load a script or anything for it. – simon Jan 27 '16 at 14:46
  • Thanks! ^ This one actually worked very very well. In fact, it worked better than the other answer. – Daniel Jan 27 '16 at 18:46

Sure. Download the ruby script from https://gist.github.com/samnung/c7e767167cf70531ccdc and then just make a bash wrapper to call it.

do_not_disturb.rb on

You'll may want a tool like FastScripts to call the script (and if so, place your bash calling script in ~/Library/Scripts for it to show up there nicely)

  • 1
    And it runs from the command line just fine, so I'll throw it in as a bind. – Daniel Nov 17 '15 at 16:31
  • Adding it as a bind was difficult, and that didn't work well so I just tossed the idea. @simon 's answer worked well. – Daniel Jan 27 '16 at 18:46

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .