Created
March 25, 2019 22:11
-
-
Save AndrewWCarson/c897552adca91a457a20a1c4610718ac to your computer and use it in GitHub Desktop.
Changes the macOS theme to Light mode in Mojave.
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
#!/bin/bash | |
# This requires the parent process to have "System Events" enabled in TCC. When | |
# running this from Addigy, /Library/Addigy/go-agent will need that | |
# whitelist. | |
username=$(/usr/bin/python -c 'from SystemConfiguration import SCDynamicStoreCopyConsoleUser; import sys; username = (SCDynamicStoreCopyConsoleUser(None, None, None) or [None])[0]; username = [username,""][username in [u"loginwindow", None, u""]]; sys.stdout.write(username + "\n");') | |
# Do nothing if no one logged in. | |
if [[ "$username" != "" ]]; then | |
# Tell "System Events" to change to light mode. | |
sudo -u "$username" osascript -e 'tell app "System Events" to tell appearance preferences to set dark mode to not dark mode' | |
fi |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment