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

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...