Dark Mode Switcher - free app

I made a little thing.

It switches betwen Dark Mode and Light Mode, quickly, from your menu bar. You can schedule the change, if you like, so that you could have Light Mode at 8am and Dark Mode at, say, 6pm.

It’s pretty useful while working on Mac projects to quickly check out how things look in Dark Mode.

It’s for macOS Mojave. It was made with Xojo. It’s free.

https://www.libertyapp.com/darkmodeswitcher/

Very nice. The 16x16 icon is corrupted.

I’d like to have the app started when I restart the computer.

This is awesome! So tired of opening System Prefs every time I need to test Dark/Light mode.

@Beatrix Willius I just added it to my Login Items.

@Gavin Smith I have a Launch at login module I can share with you if you like. (Uses MBS plugins)

[quote=434953:@Gavin Smith]I made a little thing.

It switches betwen Dark Mode and Light Mode, quickly, from your menu bar. You can schedule the change, if you like, so that you could have Light Mode at 8am and Dark Mode at, say, 6pm.

It’s pretty useful while working on Mac projects to quickly check out how things look in Dark Mode.

It’s for macOS Mojave. It was made with Xojo. It’s free.

https://www.libertyapp.com/darkmodeswitcher/[/quote]

how to open up the preference screen to set the schedule??

[quote=434960:@Richard Duke]how to open up the preference screen to set the schedule??

[/quote]
Double-click the icon in the MenuBar

[quote=434955:@Beatrix Willius]Very nice. The 16x16 icon is corrupted.

I’d like to have the app started when I restart the computer.[/quote]
Thanks for the spot on the icon, I’ll throw out a new build soon.

If you open up System Preferences, you can put it into your Login items in Users & Groups.

I used to have a bit of code that did this but I haven’t used it since the Sandbox days - does yours work in a Sandboxed app?

thanks… found it after asking

[quote=434966:@Gavin Smith]I used to have a bit of code that did this but I haven’t used it since the Sandbox days - does yours work in a Sandboxed app?

[/quote]
Nope, apparently you’d have to use a helper app to do it in the sandbox. Your old code is probably very close to my code. I haven’t needed it in a sandboxed app. It looks like you’d just have to split out the settings window from the menu item / scheduled switching parts and place the helper in Contents/Library/LoginItems and enable it with SMLoginItemSetEnabled.

It looks like it’s not too difficult aside from that. Here’s a how-to article. Apparently it also only works if the App is in /Applications.

…Or just tell users how to add it to login items (It is free after all). Thanks for putting this together BTW. Very helpful!

[quote=434955:@Beatrix Willius]Very nice. The 16x16 icon is corrupted.

[/quote]
Fixed.

There’s a couple of threads on this forum about launch at login with a Sandboxed application. If you need any help let me know.

[quote=434959:@jim mckay]This is awesome! So tired of opening System Prefs every time I need to test Dark/Light mode.

@Beatrix Willius I just added it to my Login Items.

@Gavin Smith I have a Launch at login module I can share with you if you like. (Uses MBS plugins)[/quote]

I use Keyboard Maestro to switch between Dark/Light Mode based on various events like App Launch, Location, Time, …

Execute AppleScript tell application "System Events" tell appearance preferences set dark mode to true end tell end tell

and

Execute AppleScript tell application "System Events" tell appearance preferences set dark mode to false end tell end tell

do the trick.

Thank you @Gavin Smith for making it available for free. :slight_smile:

[quote=435035:@Sascha S]I use Keyboard Maestro to switch between Dark/Light Mode based on various events like App Launch, Location, Time, …

Execute AppleScript tell application "System Events" tell appearance preferences set dark mode to true end tell end tell
[/quote]

In KM, I use this to simply toggle between modes:

tell application "System Events" to tell ¬ the appearance preferences to ¬ set dark mode to not dark mode

I keep it in the AppleScript Menu so it’s always handy.

[quote=435050:@Tanner Lee]In KM, I use this to simply toggle between modes:

tell application “System Events” to tell ¬
the appearance preferences to ¬
set dark mode to not dark mode
[/quote]

tell application "System Events" tell the appearance preferences set dark mode to not dark mode end tell end tell

(For the Copy & Paste Fans) :wink:

Awesome! Just added that to my SimpleKeys actions.

(Disclaimer: SimpleKeys is a commercial app I wrote and sell. You can setup up to 6 actions for free though.)

@Gavin Smith - Thanks for the app - very handy.

I just ran the app on Catalina and noticed that it appears in the System Prefs > Security & Privacy > Privacy > Automation list with “System Events” checked. Can I ask if you did anything to get your app to appear here?

The reason I ask is I have an app that also needs to talk to System Events via AppleScript. The app is listed and checked in the “Accessibility” list but doesn’t show in the “Automation” list. When I try to run an AppleScript in my app that talks to System Events I get the error: “Not authorized to send Apple events to System Events…” - Error No = -1743. In Mojave I’m prompted with a message that my app is trying to control System Events with the option to click “Okay”, and then the app appears in the Automation list. Now with Catalina this message no longer happens. So I just wanted to check if had this issue or if do anything special to have your app appear in the “Automation” list.

Many thanks,

Mark

@Gavin Smith - Sorry to bug you on this. I worked out why my app wasn’t able to get onto the Automation list. I use AppWrapper to wrap my app and set NSAppleEventsUsageDescription in the app’s plist.info file. There is something in my AppWrapper setup (probably something to do with Hardening it) that is stopping this from working. If I add just the NSAppleEventsUsageDescription lines manually the app works. BTW you may want to update your plist NSAppleEventsUsageDescription entry to something like:

NSAppleEventsUsageDescription
Dark Mode Switcher needs to script System Events in order to change the current theme

Many thanks,

Mark