To be able to toggle Do Not Disturb off or on by keyboard shortcut, you’ll need to enable a keyboard shortcut for it first. Here’s how to do that:
• Go to the Apple menu and select “System Preferences”
• Go to “Keyboard” and then choose the “Shortcuts” tab
• Select “Mission Control” from the Shortcuts options
• Locate “Turn Do Not Disturb On/Off” and make sure that is checked to be enabled
• Click directly to the right of “Turn Do Not Disturb On/Off” and then press a keyboard shortcut combination to set as the Do Not Disturb keyboard shortcut
In the example (see screenshot), the keystroke combination "Shift F6" was set as the keyboard shortcut for enabling and disabling Do Not Disturb mode. You can set any keyboard shortcut you want for this purpose, just make sure it’s unique and does not overlap with another keystroke combination or feature. Once the keyboard shortcut for toggling Do Not Disturb mode is enabled, you can use it at anytime by pressing the keystroke combination you set in the above steps.
When Do Not Disturb mode is on (the Notification Center icon in the menu bar is dimmed), all notifications and alerts will not show up, but they will still be contained within the Notification Center.
When Do not Disturb mode is off, all alerts and notifications will come through to the Mac as usual, showing up as pop-up alerts in the upper right corner of the screen.