Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Long press trigger #14

Open
JGrossholtz opened this issue Nov 30, 2016 · 5 comments
Open

Long press trigger #14

JGrossholtz opened this issue Nov 30, 2016 · 5 comments

Comments

@JGrossholtz
Copy link

Hi,

I want to trigger an action after a 3 second press on a button (used as an input key). Do you think Triggerhappy is the correct tool for this usage ? How could I do this ?
Maybe there is a contribution to do ?

Thank you,

@hramrach
Copy link

I think it is doable - you would have to track the keydown and keyup events for that key.

You probably can do a proof of concept without modification to thd. Write a script that touches a file on keydown and a script that checks how far the timestamp of the file is in the past and triggers an action if the key was pressed long enough and bind that to release.

caveat:

  1. key repeat could repeatedly update the timestamp. So instead you could create/check timestamp on press and check/remove on release
  2. key repeat usually does not work on multimedia keys so you will get action only after key is released and not after the designated timeout

You can spawn background sleep/check but then you have to be careful to only trigger on long press and not multiple short presses if that would be an issue for your use case.

@DocMAX
Copy link

DocMAX commented Apr 14, 2019

So, where is the answer how to configure long presses?

@hramrach
Copy link

you can script it as outlined above.

@Harvie
Copy link

Harvie commented Oct 3, 2022

I think this still might be more elegant if implemented directly at the level of triggerhappy code...

@DocMAX
Copy link

DocMAX commented Feb 19, 2024

+1, has to be implemented!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants