How to Send ^→ and ^← to the System to Change Desktops/Workspaces

I've figured out how to test the %TriggerValue% when it's a key combination like ⌥→.

In one macro: Pass arrows in a TriggerValue to do action?

The point of that was to create aliases for the ^→ and ^← keystrokes that I can type with one hand. So I know the trigger value and can test it, and when it comes time to send the keystrokes, simply using
doesn't do the job.

When I type ^→ and ^← by hand, it changes the desktop/workspace to desktop on the right or left. But when KBM types the keystroke, the screen flashes, there's a beep, and nothing else changes.

I can't tell if the problem is that KBM isn't sending the keystroke or if Apple won't accept those keystrokes unless they absolutely, positively come from a keyboard and not an app.

Does anyone have a clue?

Could I work around it by using AppleScript? I'm pretty new to AppleScript, but I've seen it used in placed where KBM can't get to the appropriate level of the system.Is this one of those?


Something changed in a relatively recent version of macOS that prevents KM's simulated keystrokes from being able to trigger the default Mission Control shortcuts for moving between spaces:

Fortunately, the workaround Peter describes in that post still works as of Big Sur 11.6. I use it myself with similar macros that trigger new Mission Control shortcuts that would be pretty difficult to type by accident:

Mission Control Macros.kmmacros (2.9 KB)

1 Like

I've done a little more testing with interesting and unexpected results. KBM can send the signal, just not when triggered by a hotkey, any hotkey.

I created an Automator file to run AppleScript:
When I run it from the Run button right there in the action, it works as expected.

When I run it from the overall Automator Run button:
I get a sound toot, a screen flash, and it moves to the next desktop workspace.

So I put that AppleScript code into KBM:

When I run that KBM macro with the KBM Editor's Run button:
it works as expected, notably without any sound or flash error indication. Totally the same when I run it with the Action's "Try Action" menu option. So KBM is capable of getting this to work.

BUT when I trigger it with any hotkey (the one shown, Option+L, Command+', whatever), I get a sound boop (different tone than the toot) and a flash and no expected action.

Why would one way of triggering the AppleScript within the Automator editor get an error flash while the other doesn't? Maybe that's a question for Apple.

However, What is the KBM difference between the KBM Editor's Run button or the Try Action and triggering it with a hotkey? It's clearly not a case that Apple doesn't allow KBM to send that signal.


Hey August,

It works fine for me from Automator on Mojave. No beep – immediately switches desktops.

Same here, unless I get my hands off the hotkey quick enough – then it switches desktops.

The problem with keyboard shortcuts run from System Events is they get adulterated when the user has other keys pressed.


I, too, am on Mojave. (I have too much 32-bit software that I don't want to have to replace until it becomes truly necessary.)

I'll experiment with the speed of my pressing the hotkeys. Thanks.

I'm unclear on what this means or how it applies. It seems to me that pressing other keys at the same time would change the key combination to a totally different hotkey. I certainly don't want the action of Ctrl+M to be invoked when I press Shift+Ctrl+M, so that's a welcome "adulteration" when I have "other" keys pressed, such as Shift. My guess is that I'm missing the concept completely. Would you elaborate?

If you have System Events press Cmd-W and you press Opt-L to activate it with Keyboard Maestro or another script-runner you end up with at best: