Skip to content

Instantly share code, notes, and snippets.

@pmbuko
Last active February 18, 2022 00:49
Show Gist options
  • Save pmbuko/499348b98b68e2d9d180e75e04648e00 to your computer and use it in GitHub Desktop.
Save pmbuko/499348b98b68e2d9d180e75e04648e00 to your computer and use it in GitHub Desktop.
Applescript to toggle a dark/quiet mode on your Mac.
tell application "System Events"
tell appearance preferences to set dark mode to not dark mode
keystroke "d" using {command down, option down, control down, shift down}
end tell
set curVolume to get volume settings
if output muted of curVolume is false then
set volume with output muted
else
set volume without output muted
end if
@pmbuko
Copy link
Author

pmbuko commented Feb 18, 2022

You need to add a keyboard shortcut for the Mission Control "Turn Do Not Disturb On/Off" item in the Keyboard pref pane for it to be able to toggle DND mode.

Save this script as an Application, then add it as an Accessibility helper app in the Security and Privacy pref pane under the Privacy tab to allow it to send keystrokes.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment