How do you configure the long press time?

I'm not sure if I follow how changing these numbers works, when adjusting the command line. If I want to, say, make the long press interval be 1.0 seconds, what would I change this to in the command line? IOW, I want the long press to not activate until the button on my Stream Deck has been held down for at least one full second.

The default appears to be:

defaults write com.stairways.keyboardmaestro.engine MaxTapDownTime -float 1.0
defaults write com.stairways.keyboardmaestro.engine MaxTapUpTime -float 1.0

What would I change these to to have the long press interval of 1.0 seconds? I'm not sure what those two 1.0 values represent?

As far as I know, they represent 1 second. Do you have reason to think otherwise?

I wasn't sure what those values meant, but even if they each represent one second, I'm still not sure what that means from a functionality standpoint, or to what values to change one or both of these values to in order to get the desired long press behavior.

What would I set each of these two values to if I want the long press to not activate until the Stream Deck button has been held down for at least one second? What about if I want the long press to only activate after 0.5 seconds?

Those terminal commands determine the length of time a trigger needs to be pressed for the native long press to be detected. It has nothing to do with the macros posted here. The press time for these macros is set in the green action of the press detection submacro.

I know that these terminal commands have nothing to do with the macros posted here in this thread, just so we're clear. But you had suggested in this thread that I try the native long press functions, and said that I could adjust the long press activation time for the native long press by adjusting things in terminal.

THIS is what I am asking about. Adjusting the long press time in terminal for the native long press functionality.

So what values do I need to change to in order to get a long press that doesn't activate until the Stream Deck button has been held down for one full second? What about for 0.5 seconds? This is what is not clear to me.

Oh ok. I haven't messed with these settings for years but presumably you set it to 0.5 for 0.5s. :man_shrugging:t2:

Have you tried this and found that it doesn't work? If not, give it a go.

Set which one to 0.5? There are two different numbers. That's what is confusing to me. I don't quite get what each of the two numbers do? If one of these variables was labeled as something like "long press interval", or something like that, it would be fairly self explanatory.. but both of these two different variables make reference to tap values, so I'm not sure what to do with these.

As for just trying it out, it's a long story, but I have your old macros pretty heavily intertwined with other macros I've created, so it's not a simple matter to untangle them. And, if I just "play with the numbers" to see what happens, it wouldn't necessarily be 100% clear that things were or weren't changing in response to my experimentation with changing those values in Terminal.

Bottom line, I want to make sure that I understand how to change these numbers, and what their effect on the trigger behavior is, before I go and start trying to switch over from your long press triggers to the native long press triggers. If you're not aware of how to change these numbers, that's cool. But Peter or somebody ought to be able to explain how to change these numbers to get the desired long press interval. I just need a clear understanding of how these values work, before I go and make any changes, that way I can trust that any irregularity isn't due to an incorrect understanding of how those two values change things in Terminal and KM.

It sounds to me like you want a definitive answer, not one determined by testing. I'm in the same boat as you ("confused"), I would have to test, and I'm not sure that testing is going to be helpful to you. It sounds like you want only the official answer. That's your prerogative. In that case, some of us can't help.

Sorry, my bad. I was at a BBQ today and reading on my phone. I didn't notice that the scripts refer to taps rather than long press. Yes, it is a little confusing. I'm sure @peternlewis can clarify.

Yeah, I'm thinking Peter will have to jump in to clarify, as I'm not sure that anyone else knows for sure how those scripts work. Thanks anyway.

None of this discussion is about the Multi-Press Macros so I have moved it to a new topic.

1 Like

The default amount of time a key must be down to be considered a long press is the double click interval on your Mac (controlled in the system settings (presumably still, Apple has changed System Settings a lot).

You can configure a specific time with the command:

defaults write com.stairways.keyboardmaestro.engine MaxTapDownTime -float 1.0

Time is in seconds, so that would require the key to be pressed and held down for at least a second and then released to trigger a long press.

If you want to trigger on either and know which, you can use a macro that triggers on tap and long pressed and check the Trigger token for containing long. Note that you must use tapped and not pressed in this test - pressed will trigger immediately the key is pressed, where as tapped and long pressed (which really should be long tapped) will trigger on the release of the key - one or the other will trigger always, never both.

1 Like

And it sounds like the default long press time is 1.0 seconds, correct? Also, to be clear, I'm not talking about hot keys. I'm talking about buttons on my Stream Deck, if that matters.

I'll give this a shot. Thanks

The same timing applies for Hot Key and USB Device Key triggers.

So if you are using the first party Keyboard Maestro plugin with Stream Deck, then the same timing applies since it works via the USB Device Key trigger. If you are using KM Link, then the behaviour of that is controlled by the plugin and I don't know its workings.

I'm still confused then, because if the long press timing is based on how the double click interval is set on your Mac, then what is the purpose of changing things in Terminal?

The "1.0" shown below, at the end of the command line is why I was asking if that was meant to be some kind of default of 1.0 seconds.

defaults write com.stairways.keyboardmaestro.engine MaxTapDownTime -float 1.0

The default is the double click interval, or you can configure it explicitly in the Terminal using the command, in which case it will be whatever you configure it to.

The 1.0 shown is the example time. The default time is the double click interval which is what is used if there is no setting for that preference.

That's very useful, thank you!

Is there a way to have long press trigger when the interval is reached, rather than on release?

The current method is useful in some cases, but in others leaves me guessing whether I've held the key long enough. Example: I want to hold a key to bring up a palette

I've been pondering your question for an hour. I'm very close to solving your request, using a ten line macro, but I have a question. When you say "rather than on release" I think what you mean is two things:

(1) you want the palette to appear if the button is held down for (let's say, for the sake of discussion) one second; AND ALSO...
(2) you want the palette to appear if the button is held down less than one second but then released.

Am I correct? You want the palette to appear if EITHER the button is held down for one second (even if not released) OR the button is released in less than one second.

If I am correct then the wording of your statement is not accurate, when you said "rather than on release" because you still want the macro to trigger on release if the duration of the button press is quite short.

If I'm correct, then what do you want if the button is released after (for example) 100 seconds, even though the palette was displayed 99 seconds ago. Do you want KM to remember that the palette was already triggered because of the one second timeout, and take NO action after the extra 99 seconds? I think that's what you want, and I think that's what my macro has accomplished.

Thank you for looking into it! Yes, that is more accurate statement of what I want.

My Muti-Press submacro does exactly this.

1 Like