input-remapper
input-remapper copied to clipboard
`while_single` macro or `ignore_release` parameter
Is it possible to map a key single press(not hold) to continuously press right click, until I press another key?
Not yet. But there is a feature request for that already: https://github.com/sezanzeb/input-remapper/issues/378
I'll close this since it's a duplicate
I just learned that there is also a macro solution for that:
if_eq(
$a,
1,
event(EV_KEY, BTN_RIGHT, 0).set(a, 0),
event(EV_KEY, BTN_RIGHT, 1).set(a, 1)
)
as far as I can tell this issue is about pressing repeatedly until any other key is pressed
as far as I can tell this issue is about pressing repeatedly until any other key is pressed
Not really, what I want is to let the right click down.
so you want to have the right click pressed, until any other key is pressed
- you click the left button once
- it keeps holding down
- you hit, for example, the middle mouse button
- left button is released
?
Yes
I don't think this is possible right now.
If there was a while_eq macro maybe it would be possible to write something that continuously calls if_single to wait for another key press, which then sets a variable that stops while_eq. I wonder how well that would work, if a key is pressed between if_single calls it wouldn't work.
Or while_single of course, I guess that could be implemented. I'm not sure yet if that would work the way I think it would though. What would while_single do if the key is released
I'll rename this issue and add a feature-request label to keep track of the while_single idea
if_single runs then when the key is released, or else when another key is pressed.
I think the potential future while_single macro would repeat a provided macro-parameter until another key is pressed or the key is released. To ignore the release, it would need an ignore_release parameter. The macro-parameter would just be something like wait(10) or something which makes it block for a while.
however, if_single could also receive a new ignore_release parameter and by doing so it would just block forever until another key is pressed. Arguably, blocking until an event arrives is better than looping and polling.
This works already, but only if the "another key" is one of your mouse keys.
key_down(BTN_RIGHT).
# wait until key released
if_single(
# released
# wait for another key press
if_single(None, None),
# other key pressed before the release, just continue
None
).
key_up(BTN_RIGHT)
Edit: updated with new key_down, key_up macros and None
and don't forget to set the dropdown to "Mouse"
I think this issue (#382), #198 and #378 can all be solved with the mechanism I proposed in this https://github.com/sezanzeb/input-remapper/issues/378#issuecomment-1105156174
@sezanzeb It should also be simple to implement, so maybe a good candidate to work on the new injection system.
My problem was solved with your solution
I think this issue (#382), #198 and #378 can all be solved with the mechanism I proposed in this #378 (comment)
Maybe we do both. How would you propose to allow the user to enable the mapping handler?
we can have a mapping parameter for that. Maybe call it input_mode with an default value of normal and for the new handler we can set it to toggle