Keystroke doubled(?) if trigger file is activated *via dock only*

This is so bizarre. I'm trying to toggle the "Show Desktop" feature of Mission Control.

The Keyboard Shortcut for that setting is set to F11. However, I want to use an icon in the dock, so it's easier to toggle when I'm controlling it from my iPad/iPhone.

I have a KM Macro where all it does is simulate F11. I save it as a trigger file to my desktop.

If I launch the trigger file from the desktop, it works fine. Running it either shows the desktop (hides apps) or restores/shows the hidden apps).

However, I dragged the trigger file to my Dock, and if all my windows are showing, and I click on the Dock, everything hides (i.e. Show Desktop "on"). So far so good.

But if I click on the Dock icon again, it restores all hidden apps, but then hides them again (almost as if it hit F11 twice).

I've even deleted the macro and re-created it and the trigger file from scratch and I get the same results.

I've even tried using an Applescript instead of KM's native "type a keystroke" but I get the same results:

tell application "System Events"

key code 103 -- This simulates F11, the default "Show Desktop" shortcut

end tell

Any ideas on what the heck is going on and/or if there's a workaround for this odd behavior?

Doesn't clicking on a Dock icon take you out of "Show Desktop" anyway? So you're clicking on the icon, which "unshows" the Desktop, to trigger the macro, which "Show"s it again.

I can't see a way round that when using the Dock -- you may have to find another way to do what you want...

1 Like

Oh, I guess that makes sense.

This is getting esoteric, but I did some testing. After "un-Showing" the Desktop:

Clicking on an app in the Dock Shows the Desktop again.
Double-clicking on an app on the desktop to open it Shows the Desktop again.
Opening an app via Alfred leaves the Desktop "un-Showed". But if I do it a second time, all the hidden apps appear again.

Maybe I'll use a KM Palette or something. Thanks!

1 Like