Recurse Triggers & Auto Adapt to Keyboard Layout

I'm using KM for quite some time now and recently acquired BetterTouchTool as well (primarily for Trackpad Gestures).

Two things I prefer with BTT keyboard shortcuts - or haven't found out how to enable this in KM:

  • Recurse triggers:
    Having CMD-' mapped to CMD-DEL and having a Macro CMD-DEL in Apple Mail.
    BTT then maps CMD-' in Apple Mail to trigger the CMD-DEL macro. (You can disable this behavior)
    With KM I haven't found a way but to use an 'if' in the CMD-' macro and then trigger the CMD-DEL macro instead of sending CMD-DEL.
    I definitely wouldn't want this enabled for all macros but to choose where it makes sense would be nice.

  • Auto adapt to current keyboard layout:
    When recording CMD-P as macro trigger in the US layout and then switching to another software keyboard layout (e.g. Colemak) the key CMD-P will be CMD-Y.
    Since with the Colemak layout the Y is in the place where P is in US.
    In BTT it can be enabled to adjust this so pressing CMD-P will work in both (instead of always pressing the key where P is written on).
    I have an external keyboard with a hardware layout of Colemak and else use my laptop with software Colemak. Whenever I disconnect my external keyboard I can't use most of my macros since they're on totally different keys. I've duplicated the most important ones into two groups (where only one is active) but it would be nice to get rid of this workaround.

Ideally I could get both of this working from within Keyboard Maestro since I prefer the interface and the automatic conflict palette.

Has someone had similar struggles or an easy solution I haven't thought of?

I'm not sure I completely understand what you're trying to achieve, but here's my current best-guess:

Create a macro group in KM that's only active in Apple Mail like this:
KM 0 2021-08-18_10-21-55

I've put a couple of macros in there that hopefully answer your question.

The macro CMD-' triggers when the hotkey ' is pressed as follows:
KM 1 2021-08-18_10-22-44
This macro then executes another macro called CMD-DEL which in my case looks like this:
KM 2 2021-08-18_10-23-21

The overall effect is that only when Apple Mail is active the key sequence ' is mapped onto a different macro.

By creating different macro groups for different apps you can use this technique to map your hot key onto anything you like without the need for IF actions since you can have as many different macros in each group as you like.

Obviously I've only created this as an example for you so you'd need to modify the group and macros to suit your specific needs.

I apologise if I've misunderstood your meaning but if I have maybe you'd like to comment on what I've suggested.

Cheers!

As for this you can specify multiple triggers for macros. In this example you can see what I mean:

KM 0 2021-08-18_22-54-04

So for triggers you might be able to specify P on your internal keyboard and Y on your external keyboard if it appears as a different input device.

You'll obviously need to experiment a bit to see if this will work!

Thank you for your reply!

For the Recurse Macros I rather meant that I have a global (in all Apps) macro for CMD-' which maps to CMD-DEL.
I then have a macro for Mail which maps CMD-DEL to some functionality.
With KM I need to have a if statement in the global macro which checks for the currently running app and then execute this macro instead of triggering CMD-DEL with its default behavior in Mail.
With BTT I'm able to specify that CMD-' should "recurse" which would result in CMD-' triggering the CMD-DEL macro with my functionality. Which is much easier since I don't have to add an if statement (and no need to remember to adjust it if I map CMD-DEL in any other app.
Obviously I can also choose not to "recurse" if I don't want this behavior.

The tip to use the device keys instead of keystrokes is nice. I'll look into it!
But I'm not sure if there is any downside to this. Aside from having to specify two keystrokes per macro.
I still think the way BTT does it is way easier though. It is just one toggle and it just works no matter what software keyboard layout is used.