Skip to content

Instantly share code, notes, and snippets.

@piratus
Created October 24, 2020 15:04
Show Gist options
  • Save piratus/eb16c528cc10120985f04c0d51b43909 to your computer and use it in GitHub Desktop.
Save piratus/eb16c528cc10120985f04c0d51b43909 to your computer and use it in GitHub Desktop.
Toggle MacOS Dark/Light mode
#!/usr/bin/env osascript -l JavaScript
function run(input, parameters) {
const appSE = Application("System Events");
appSE.includeStandardAdditions = true;
if (appSE.appearancePreferences.darkMode()) {
setLightMode(appSE)
} else {
setDarkMode(appSE)
}
}
function setLightMode(appSE) {
appSE.appearancePreferences.darkMode = false;
appSE.currentDesktop.picturesFolder = "/Users/andriip/Pictures/Desktop Light"
}
function setDarkMode(appSE) {
appSE.appearancePreferences.darkMode = true;
appSE.currentDesktop.picturesFolder = "/Users/andriip/Pictures/Desktop Dark"
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment