input-remapper
input-remapper copied to clipboard
Key acting normally if pressed alone, as modifier if combined
Let's say I would like to use Space as a Left CTRL+Left Alt modifier but only if it's used in combination with other key.
Single Space would generate a " ". Space + Del would bring up a shutdown dialog/lock screen etc.
Closest I was able to get is:
space = if_single(k(KEY_SPACE), h(m(KEY_LEFTCTRL, k(KEY_LEFTALT))))
It works only partially as it looks like the modifiers are released before the second key is registered (OS probably sees Left CTRL+Left Alt and Del as separate events).
hold
will repeat calling the modify
macro (see https://github.com/sezanzeb/input-remapper/blob/main/readme/macros.md#hold)
try
space = if_single(key(KEY_SPACE), modify(KEY_LEFTCTRL, hold(KEY_LEFTALT)))
thank you. it's much better although it does not react immediately. instead i have to press Del twice so a working sequence is as follows:
- press and hold Space
- tap Del (and Del is interpreted normally, i. e. a character is erased)
- tap Del again
- release Space
Try to reduce keystroke_sleep_ms
to 0
in the config json: https://github.com/sezanzeb/input-remapper/blob/main/readme/usage.md#configuration-files
either the global json, or the json of your preset
Thank you, that worked. The documentation does not currently detail what is the purpose of this setting (apparently cases like these) or what are the implications (performance?).
Early during development I observed that it would not inject the key
macros properly when the timeout is too small.
Let me know if you are facing any issues, maybe defaulting this setting to 10 is obsolete
The Del
event is already ready to be injected, but the macro uses timeouts, so the else
macro is started too late. The Del
event is injected before KEY_LEFTALT
is injected.