I wrote up this quick AppleScript that can be utilized with HotKeys or a Touch Bar Button to toggle macOS Mojave's Dark Mode
tell application "System Events"
tell appearance preferences
get properties
if dark mode is false then
set dark mode to true
else
set dark mode to false
end if
end tell
end tell
hey! Can I add AppleScript straight to the BTT (how?) or do I need to make the script first and then add a button that opens the ScriptEditor and run the script?
You can add it as "Run Apple Script (async in background)" but really this got deprecated because there is now a built-in "Toggle Dark Mode" option which probably works better.
Hi - I do not know how to use apple script, but came here looking for a way to toggle dark mode/light mode through a Touch Bar action. You say there's a toggle dark mode option - where? through BTT? Or is there a Mac shortcut? How can I get this to work?
Toggle Dark mode is under OSX Functionality in predefined actions. You can set it to a button or widget on Touch Bar, as a Keyboard shortcut, Trackpad gesture, etc.
If you want it to be a widget which changes icon/colour depending on whether Dark Mode is on or off, you can use this apple script:
tellapplication "System Events" if dark mode of appearance preferences isfalsethen return "Off" else return "On" endif endtell
I know this is a more general question, but although I have this button in the 'global' section, it only shows up when I hit the BTT button on the control panel. Why isn't it ... globally available, always present, like the ESC "key"?