"Press and Hold Modifiers"

Regarding "Press and Hold Modifiers" the KM manual says.

"Keys that are pressed remain pressed only as long as the macro is running."

Is this not the case if I select "is down" and "press and hold"?

"Is down" is a trigger and will press and hold the modifiers briefly. Then the macro ends and they release... is my understanding.

If you want the modifiers to be pressed as long as you hold the trigger hotkey, you can use Pause Until the hotkey is up and then release the modifiers.

Take this with a pinch of salt as I've had a couple of :beers:.

2 Likes

Hi @noisneil, yes, exactly that. But I don't know how to do that. Would you be so kind to post me something?

Edit: I need this to display something in the touch bar that is only visible when these modifiers are down. Unfortunately BTT can not do that :joy:

I think @noisneil is exactly right and I would guess you implement it something like this:

NB - use "is pressed" rather than "is down" for the "5" trigger otherwise the Macro will fire over and over again. What you want is the macro to fire once and pause until the "5" key is up.

4 Likes

Thank you @Zabobon

It almost works. When I press and hold "5", I see what I want to see on the Touch Bar for a moment, but it disappears right away.

It should not disappear until I release "5". Mmmm?

For testing purposes, instead of the "pause until 5 is up" you could try "pause for 10 seconds" and see if that keeps those modifiers pressed until the Macro ends.

You mean that, don't you? No, unfortunately does not work.

You have "type" instead of "hold" in your Action

That Action should be "press and hold" as you had originally. Have another look at my original screenshot.

1 Like

Ah, yes, sorry, that's how it works. I see what I want to see for 10 seconds.

But I would prefer just as long as "5" is pressed.

Yes. It will work that way. As long as the "5" key is pressed down, those modifiers will be held. I only mentioned trying the timed pause when you said it wasn't working. But it wasn't working because you had that modifier key Action as "type" instead of "press and hold"

4 Likes

Yes! Now it works. Sorry for the confusion and thanks @Zabobon :smiley:

2 Likes

Is there any setting in KM that would prevent "Press and Hold Modifiers" from working? I have tried different versions and cannot get it to work at all.

What is “not working”?

The hold will only hold the modifiers until the macro finishes, after which the modifiers will be released.

Also, you cannot mix simulated modifiers and manual UI (so for example, you cannot use the Press and Hold modifier Shift and then manually press the a key and expect to get A). The system does not work that way, simulated keys and modifiers do not affect real keys and modifiers.

Thanks, I think I ended up realizing this and coming to the same conclusions. I was trying to make a 'sticky' hyperkey so that I don't have to hold it down when I'm using some hyperkey shortcuts repeatedly (Safari navigation, for instance).

For anyone reading this who is trying to do a similar thing, I ended up creating a macro group (let's say, "sticky keys") with individual macros emulating whatever hyperkey shortcuts I wanted to use (JIKL for arrow keys, D/F for previous/next tab, etc.) and then used a macro (in a different macro group!) connected to a key press (F8, in my case) to toggle whether the "sticky keys" macro group is enabled or disabled.