Just a switch tutorial.
That switch your system theme needs your authorization. Just click OK.
- Switch your system theme using AppleScript
- Hide / Show your desktop icons using NSTask(aka Process)
- MenuBar only when your Cocoa Application is agent.
- Start at login using serviceManagement (embed a helper login app to wake main application up.)
tell application "System Events"
tell appearance preferences
set dark mode to not dark mode
end tell
end tell
You can just using ScriptEditor to run this AppleScript to switch the dark theme and light one.
applescript://com.apple.scripteditor?action=new&name=Change%20Theme&script=tell%20application%20%22System%20Events%22%0D%09tell%20appearance%20preferences%0D%09%09set%20dark%20mode%20to%20not%20dark%20mode%0D%09end%20tell%0Dend%20tell
defaults write com.apple.finder CreateDesktop false
killall Finder
Input the two lines in your terminal, icons just hidden.
If you want recover your icons, just change false
to true
.
hide Desktop Icons
show Desktop Icons
# enable caffeinate forever.
# never return.
caffeinate
# disable caffeinate
killall caffeinate