Cmd-Tab not preempting keystrokes passed to origin application

I use an app (Trilium Notes) that doesn't correctly map cmd-left/right-arrow to move to the start/end of line. It uses "home" and "end" instead. I mapped these in KM and limited the macros to that single application.

Now, if I have that app in the foreground and press Cmd-Tab to switch to another application, and if I use the arrow keys to move through the apps in the KM switcher, it thinks that Trilium Notes is still in the foreground and executes the macro, exiting the command switcher and passing Fn-left/right-arrow to whatever app happens to be next in the list.

I think this can be fixed by having KM recognize that the switcher is active instead of the previous application. I don't think there's any situation where I would start to use the app switcher and still want a keystroke/command mapped to the application that I was just using. Alternatively having a way to tell KM "Only trigger this macro if the keystroke right before it was not Cmd-Tab," but that seems like the wrong route.

Try editing the "Activate Application Switcher" macro so that it disables your two Trilium-targeting macros on launch and re-enables them just before it finishes -- you should be able to pause the Switcher macro until the ⌘ key is released:

Hacked Activate Application Switcher.kmmacros (4.7 KB)


I've put in notifications so you can see what's happening -- delete them once you're happy. Change the "Disable/Enable" actions (and add more if necessary) to target the macros you want to turn off.

Hot sauce. That worked. Thanks!