Keyboard Maestro beats System Preferences
May 24, 2017 at 9:32 PM by Dr. Drang
Way back in September of 2014, I wrote about a problem I was having with a keyboard shortcut to toggle Mission Control’s Show Desktop feature. Basically, whenever I rebooted my iMac, the keyboard shortcut stopped working, even though it was still checked in the Keyboard Shortcut system preference.
I found a workaround:
Through trial and error, I’ve learned how to solve the problem and, in some cases, how to prevent it from happening in the first place. If I uncheck the Show Desktop box in the Keyboard Shortcuts panel and then reboot, rechecking the box after the reboot will get the shortcut working again. Unfortunately, I reboot so infrequently that I almost never remember to uncheck the box ahead of time. It’s only after I get a beep when I hit F6 that I realize what I’ve done have to reboot a second time.
This problem started with Mavericks and occurred only on the iMac, never on my MacBook Air. Rereading that post, I see how innocent and naive I was back then:
With luck, Yosemite will erase this annoyance and I won’t have to think about it again.
As you have no doubt guessed by now, Yosemite didn’t erase the annoyance. Nor did El Capitan or Sierra. Today, after running into the problem once again, I decided to take matters into my own hands. I turned off that shortcut in System Preferences and built a Keyboard Maestro macro to do the job.
It’s a one-step macro:
The macro is triggered by F5, the only function key on both my iMac and MacBook Air that doesn’t have a feature assigned to and printed on it.
The shell command it executes is
/Applications/Mission\ Control.app/Contents/MacOS/Mission\ Control 1
which I learned about indirectly through this old Mac OS X Hint. Back when the hint was written, there was no Mission Control, but there was Exposé, and the hint is about calling the Expose
binary buried in the Expose.app
package:
/Applications/Utilities/Expose.app/Contents/MacOS/Expose 1
After reading the hint, I guessed that the same thing would work with Mission Control. And it did. Once I knew the invocation, I was able to search for it directly and found this Ask Different page, which explains the arguments you can pass to it:
- 1 is for Show Desktop, as we’ve seen.
- 2 is for Application Windows, which hides everything except the windows of the current application, which it shows miniature versions of.
- no argument (or any argument other than 1 or 2) is for the usual Mission Control action, which shows mini versions of all the windows.
The other two behaviors don’t interest me, as I’ve never had a problem with the keyboard shortcuts for Mission Control or Application Windows. And now I won’t have a problem with Show Desktop, either.