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

 

workflow.png

 

Download Workflow

View on Github

Link to post
  • 3 months later...

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. 

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()
	}
}

 

Link to post
  • 1 month later...
  • 3 weeks later...

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


 

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.

Guest
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...