Jump to content

macOS Mojave Theme (Dark mode) switcher

Recommended Posts

Hey everybody, I've been testing out macOS Mojave + Dark mode the past few days and wanted to be able to toggle between the light theme and dark theme using alfred. So I made a simple workflow for it.

It's probably not useful to most of you yet (as Mojave it's still on dev beta 1) but i'll be making sure it stays working as there are more updates




Download Workflow

View on Github

Share this post

Link to post

Awesome! I hadn't seen that one before. While the AppleScript in the theme does work to toggle between light and dark mode, running the workflow doesn't toggle it for me. I'll have to try and figure out why

Share this post

Link to post

Yep, you can open the workflow and edit the Run Script element. Right at the top there's 2 lines that say

var alfredLightTheme = "Alfred"
var alfredDarkTheme = "Alfred Dark"

You can change them to whatever theme you want for when the mac is in light/dark mode. Just put them both to the same theme name if you want it to always be the same.


I may be adding support for other apps and I'll make the process better if I do. 

Share this post

Link to post

This is the script completely without the Alfred theme switching part:


function run(args) {
	args = args ? args : []
	var systemEvents = Application("System Events")
	if (args && args == 'dark') {
		systemEvents.appearancePreferences.darkMode = true
	} else if (args && args == 'light') {
		systemEvents.appearancePreferences.darkMode = false
	} else {
		systemEvents.appearancePreferences.darkMode = !systemEvents.appearancePreferences.darkMode()


Share this post

Link to post

Hi cama900,

Thanks for sharing the WF, just what I was thinking about.

Do you have an idea where to get the sunrise / sunset trigger from?

Would be interesting to add an automatic trigger to your WF

Share this post

Link to post

I'm trying to extend this workflow to change the wallpaper with it. Does anyone know how to apply the new desktop picture to all spaces?


Atm my script looks like


set theQuery to argv
	set thePath to "~/Dropbox/Pictures/" & theQuery & ".png"

	tell application "System Events"
		tell every desktop
			set picture to POSIX file thePath
		end tell
	end tell
	do shell script "killall Dock"
end run


Share this post

Link to post

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

  • Create New...