more info on macros in readme, preventing duplicate hold macros running forever

xkb
sezanzeb 4 years ago committed by sezanzeb
parent ddefaa90ff
commit 29a7b6473d

@ -22,6 +22,7 @@ It is possible to write timed macros into the center column:
- `k(1).k(2)` 1, 2
- `r(3, k(a).w(500))` a, a, a with 500ms pause
- `m(Control_L, k(a).k(x))` CTRL + a, CTRL + x
- `h(k(1))` writes ones while the key is pressed down
Documentation:
- `r` repeats the execution of the second parameter
@ -31,7 +32,8 @@ Documentation:
- `h` executes the parameter as long as the key is pressed down
- `.` executes two actions behind each other
Syntax errors are logged to the console.
Syntax errors are logged to the console. each `k` function adds a short delay
of 10ms that can be configured in `~/.config/key-mapper/config`.
##### Names

@ -90,6 +90,15 @@ def handle_keycode(code_to_code, macros, event, uinput):
# only key-down events trigger macros
return
existing_macro = active_macros.get(input_keycode)
if existing_macro is not None:
# make sure that a duplicate key-down event won't make a
# macro with a hold function run forever. there should always
# be only one active.
# TODO test, throw in a ton of key-down events and one key up
# event and check that no macro is writing stuff
existing_macro.release_key()
macro = macros[input_keycode]
active_macros[input_keycode] = macro
# TODO test that holding is true

Loading…
Cancel
Save