Created
January 17, 2019 04:37
-
-
Save mutsune/925de861a8a57cc8fe6c370df98d0ece to your computer and use it in GitHub Desktop.
enable/disable Dark Mode scripts
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| function enable_darkmode() { | |
| set_darkmode "$1" "no" | |
| } | |
| function disable_darkmode() { | |
| set_darkmode "$1" "yes" | |
| } | |
| function set_darkmode() { | |
| app="$1" | |
| identifier="$(osascript -e "id of app \"${app}\"")" | |
| if [[ "${identifier}" == "" ]]; then | |
| echo "Unknown app: ${app}" >&2 | |
| exit 1 | |
| fi | |
| osascript -e "tell application \"${app}\" to quit" | |
| defaults write "${identifier}" NSRequiresAquaSystemAppearance -bool "$2" | |
| osascript -e "tell application \"${app}\" to activate" | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment