Skip to content

Instantly share code, notes, and snippets.

@darren
Created January 15, 2019 11:50
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save darren/637771c945a44ee757e864e640b21ec3 to your computer and use it in GitHub Desktop.
Save darren/637771c945a44ee757e864e640b21ec3 to your computer and use it in GitHub Desktop.
switch macOS dark mode to prevent iMac image retention
#!/usr/bin/env bash
# 1. what is image retentiion: https://support.apple.com/en-us/HT202580
# 2. Put this file ~/.local/bin/
# 3. then Add this to crontab
# */10 * * * * ~/.local/bin/switch-darkmode.sh
osascript -e '
tell application id "com.apple.systemevents"
tell appearance preferences
if dark mode is true then
set dark mode to false
else
set dark mode to true
end if
end tell
end tell
'
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment