On this page
I saw something making the rounds in the dev community recently, so I built a small tool — a quick way to consolidate a few Cocoa-app features I’d been meaning to try. Practice project, basically. Right now it includes two switches: toggle the system theme, and hide the desktop icons.

Features
- Toggle the system theme
- Show or hide desktop icons
- Pure menu-bar-only app (no Dock icon)
- Launch on login
I covered the implementation of point 3 in another post, and point 4 in this one.
Toggling the system theme
The system-theme toggle is built on top of AppleScript:
tell application "System Events"
tell appearance preferences
set dark mode to not dark mode
end tell
end tell
You can run this AppleScript yourself to toggle the theme — try the link below.
Showing/hiding desktop icons
Hiding the desktop icons is really just running a system shell command. A Cocoa app can launch a process via Process (the new name for NSTask), and that’s exactly what we do here — kick off a short command line via NSTask:
defaults write com.apple.finder CreateDesktop false
killall Finder
Try it:
Click here to hide Desktop Icons
Click here to show Desktop Icons
If you’re curious, take a look at the code — the gist is straightforward. Releases
TODO
- Add more switches
- Add user-customised switch settings