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

Give support to button holding lock #198

Open
CarlosEkisde opened this issue Oct 26, 2021 · 4 comments · May be fixed by #427
Open

Give support to button holding lock #198

CarlosEkisde opened this issue Oct 26, 2021 · 4 comments · May be fixed by #427

Comments

@CarlosEkisde
Copy link

It would be nice having an option which when switched on made that pressing a particular button would be equal to hold it for the virtual device, and when pressed again, it would be released. It would work for some usecases particularly disabled persons or just for convenience.

@sezanzeb
Copy link
Owner

This is really uncomfortable to use, but a macro can do it:

if_eq($mode, 1, e(EV_KEY, KEY_A, 0).set(mode, 0), e(EV_KEY, KEY_A, 1).set(mode, 1))

there should probably be

key_up(a) and key_down(a) to simplify it a bit

@sezanzeb sezanzeb changed the title [Feature Request] Give support to button holding lock Give support to button holding lock Oct 26, 2021
@sezanzeb
Copy link
Owner

sezanzeb commented Nov 3, 2021

implementing if_unreleased would help

if_unreleased(a, key_up(a), key_down(a))

but the naming of if_unreleased might be ambiguous, considering a fictional macro of if_held or similar, which might refer to a key being held down on the keyboard. But maybe not and it is perfectly valid.

would key_up and key_down be better than key_release and key_press? "pressing a key" might refer to a complete keystroke in common language, so press might not be the best choice.

TODO:

  • key_up (like key, but injects one event of value 0) (easy to implement)
  • key_down (like key, but injects one event of value 1) (easy to implement)
  • if_held (if the physical key of the mapping is pressed down) (somewhat easy to implement)
  • if_unreleased (if key-mapper injected or forwarded a KEY_A down event, but not yet one that releases it. By using the unreleased datastructure it might work. Does unreleased also keep track of unmapped/forwarded keys? I guess that would be wanted as well for this macro) (might be a little bit difficult to implement)

@sezanzeb sezanzeb added this to 1.3.0 in to-do Dec 2, 2021
@sezanzeb sezanzeb mentioned this issue Jan 13, 2022
11 tasks
@sezanzeb sezanzeb moved this from 1.3.0 to Important Problems in to-do Jan 14, 2022
@sezanzeb
Copy link
Owner

sezanzeb commented May 4, 2022

similar: #382 (comment)

@sezanzeb
Copy link
Owner

sezanzeb commented May 7, 2022

added key_down and key_up:

if_eq(
    $mode,
    1,
    key_up(KEY_A).set(mode, 0),
    key_down(KEY_A).set(mode, 1)
)

@sezanzeb sezanzeb linked a pull request Jul 10, 2022 that will close this issue
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
to-do
ToDo
Development

Successfully merging a pull request may close this issue.

2 participants