Long key press with stream deck

First of all: thanks for the stream deck plug-in and the new actions in KM 9!
Most of my buttons are now handled by KM instead of the stream deck app.

One thing I got stuck, is getting a long/short key press combination to work. All solutions that I found in the forum depend on some kind of condition to check if the key ist still down. But unfortunately the key condition does not recognise the stream deck buttons. Device Keys seem to be available as triggers only – or did I miss something?
Any other things I could try?
Thanks in advance,

If it worked with KM8, then it is probably a KM9 bug for Peter.

Can you confirm it worked with KM8? Also links to the “All solutions that I found in the forum” might be helpful. Also posting the downloadable macro – and also a screenshot of the macro – would be a bonus.

Edit: “bonus” = ‘helpful to get a quick solution‘ :wink:

Relatively sure he can't check in KM8, because the stream deck wasn't officially supported in KM8, and it's unlikely that KM8 will recognize the streamdeck keys as triggers correctly.

Could be wrong, but my thinking is 'it's a new feature to KM9, I wouldn't expect it to work at all in KM8, much less work better in a version it didn't yet exist in...'

Thanks for the info.

JohnH, I tried a thought I'd had, basically two macros, the first is triggered when you press the button down, waits a moment, then enables another macro that's triggered on release. Sadly didn't really work (the second macro won't pick up the 'release' trigger if it didn't also see the 'down' trigger, I guess?) From what I can tell there isn't really a nice clean way to do it. Maybe you could make something with like, a global counter variable and the 'is down' trigger? Might work. You'd need to reset that global counter with another 'is released' macro.

You’re on the right track. Basically, use two macros, one on press and one on release. On press, record the start time (the SECONDS function is good for this). On release, check the time and do the appropriate behaviour if it is long enough or short enough.

Ooooh that trick feels like it's gonna give me some other ideas now too...

1 Like

Which is exactly how Keyboard Maestro is designed. It's not trivial to start with, but each thing you learn multiples all the other things you've learnt.

1 Like

Thanks for all your ideas. Here is the solution I came up using a variable:

Macro "ShortPress" sets the variable to 1 if the key is released:

I use this Macro for all keys that need long/short press conditions. So it is defined only once but triggered by many keys.

Macro "Button" sets the variable to 0, pauses for half a second. Then if in the meantime the variable is 1 (= the key has been released and triggered Macro "ShortPress") the action for short press is executed. Otherwise (= the key has not yet been released) the action for long press is executed.



So helpful. Thank you.

Better than Pause 0.5 seconds would be Pause Until ShortPress is not 0, timeout after 0.5 seconds without notification or abort.

That way as soon as you release it for a short press the action would happen.

1 Like