How to enable / disable dark mode in macos mojave with a keyboard shortcut
Table of contents:
macOS Mojave has been officially available for more than a week, One of its star features is the new dark mode, however, activating and deactivating this function can be cumbersome since it requires entering “System Preferences” to make the modification. But thanks to Automator, we can create a custom keyboard shortcut that will allow us to toggle between light mode and dark mode quickly.
Create the Automator script
The first step is to create the proper script. To do this we open the Automator app and click on New document. Select Quick Action and press Select .
In the drop-down menu "The workflow receives", we select the option "no input data" (4). Now, making sure that in the sidebar we have the “Actions” option selected (5), we write “Apple” in the search box (6) and we double-click “Run Applescript” (7).
Now, in the writing box with white background, select the text that has been written, delete it, and copy and paste the following code (8):
tell application “System Events”
tell appearance preferences
set dark mode to not dark mode
end tell
end tell
Test that the script works correctly by pressing the "Play" symbol (9) that you see above the text box. It will see how your Mac changes from light mode to dark mode or vice versa each time you press it.
The next step is to save the work you have done, for it:
- Click File in the menu bar. Click Save. Assign a name to this script, for example, Give Mode Click Save
Create the keyboard shortcut
We already have created the script that will allow us to activate and deactivate the dark mode in macOS Mojave however, for this action to be possible we need a keyboard shortcut, a unique key combination that prevents us from entering “system preferences” every time that we want to alternate between light mode and dark mode. This is also a very simple task, and for this you must follow the following steps:
- First, open the System Preferences application. Select the Keyboard section. Within this option, select Quick functions. Click on Services Search for Dark Mode (this is the script we created earlier). Make sure that the box next to this service is checked Click the Add quick function box Now you must enter the key combination you want to use to run the service, that is, to quickly switch between light mode and dark mode. Note that you will need to use a key combination that is not already in use, so you may have to try different combinations. For example, you will not be able to use Command + C because it is the classic “copy” shortcut that is already in use. I have chosen the combination Command + O.
Probably, when you run the keyboard shortcut for the first time, the following window will appear, but you only have to click on Allow:
From now on, every time you press Command + O (or the keyboard shortcut that you have associated with the script created in Automator), your Mac will go from light mode to dark mode, or from dark mode to light mode. Without a doubt, it is a much simpler and faster option than having to access the system preferences to execute it.
Keep in mind that if you have chosen a keyboard shortcut that already works with another application, for example iTunes, this shortcut that you have created for the dark mode will not work while iTunes is open.
How to activate dark mode in macos mojave 10.14
The new version of macOS Mojave 10.14 desktop includes one of the functions most expected by users, dark mode, and we will tell you how to activate it
How to disable dark mode in google chrome
This time we tell you how to disable dark mode in Google Chrome for Mac keeping it in the rest of apps and in the system
How to disable dark mode only in apps (macos)
If you want, you can disable dark mode in apps on macOS, while keeping it in system elements