rvaiya / keyd

A key remapping daemon for linux.
MIT License
3k stars 175 forks source link

Additional modifiers are sent #279

Closed yyy33 closed 2 years ago

yyy33 commented 2 years ago
  1. I tried to use keyd to send some ascii escape sequences to the terminal, here is my configuration file
[ids]
*

[main]
escape = capslock
#capslock = overload(capslock{warpd}, escape)
capslock = overload(capslock{alacritty}, escape)
#F29 - F28
leftcontrol = overload(leftcontrol{alacritty}, macro(esc [15;5~))
leftalt = overload(leftalt{alacritty}, macro(esc [1;5S))
leftshift = layer(leftshift{alacritty})

[capslock{warpd}]
#F13 - F16
h = f13
j = f13
k = f13
l = f13
n = f14
m = f15
; = f16

[capslock{alacritty}]
#F63 - F53
h = macro(esc [1;4R)
j = macro(esc [1;4Q)
k = macro(esc [1;4P)
l = macro(esc [24;3~)
u = macro(esc [23;3~)
= = macro(esc [21;3~)
- = macro(esc [20;3~)
0 = macro(esc [19;3~)
enter = macro(esc [18;3~)
. = macro(esc [17;3~)
o = macro(esc [15;3~)

[capslock{alacritty}+alt]
#F52 - F46
h = macro(esc [1;3S)
j = macro(esc [1;3R)
k = macro(esc [1;3Q)
l = macro(esc [1;3P)
= = macro(esc [24;6~)
- = macro(esc [23;6~)
enter = macro(esc [21;6~)

[leftcontrol{alacritty}:C]
#F45 - F40
; = macro(esc [20;6~)
, = macro(esc [19;6~)
enter = macro(esc [18;6~)
. = macro(esc [17;6~)
[ = macro(esc [15;6~)
' = macro(esc [1;6S)

[leftcontrol{alacritty}+shift]
#F39 - F38
; = macro(esc [1;6R)
, = macro(esc [1;6Q)

[leftalt{alacritty}:A]
#F37 - F33
; = macro(esc [1;6P)
, = macro(esc [24;5~)
enter = macro(esc [23;5~)
. = macro(esc [21;5~)
' = macro(esc [20;5~)

[leftalt{alacritty}+shift]
#F32 - F31
; = macro(esc [19;5~)
, = macro(esc [18;5~)

[leftshift{alacritty}:S]
#F30
enter = macro(esc [17;5~)

#F27 - ...
#macro(esc [1;5R)
#macro(esc [1;5Q)
#macro(esc [1;5P)
#macro(esc [24;2~)
#macro(esc [23;2~)
#macro(esc [21;2~)
#macro(esc [20;2~)
#macro(esc [19;2~)
#macro(esc [18;2~)
#macro(esc [17;2~)
#macro(esc [15;2~)
#macro(esc [1;2S)
#macro(esc [1;2R)
#macro(esc [1;2Q)
#macro(esc [1;2P)
  1. When I press ctrl-enter, I get the following keystroke event(Captured by xev). As you can see, keyd sends 4 additional control_land 2 shift_l

KeyPress event, serial 36, synthetic NO, window 0x1c00001, root 0x579, subw 0x0, time 593701, (636,176), root:(637,229), state 0x0, keycode 37 (keysym 0xffe3, Control_L), same_screen YES, XLookupString gives 0 bytes: XmbLookupString gives 0 bytes: XFilterEvent returns: False

KeyRelease event, serial 36, synthetic NO, window 0x1c00001, root 0x579, subw 0x0, time 593789, (636,176), root:(637,229), state 0x4, keycode 37 (keysym 0xffe3, Control_L), same_screen YES, XLookupString gives 0 bytes: XFilterEvent returns: False

KeyPress event, serial 36, synthetic NO, window 0x1c00001, root 0x579, subw 0x0, time 593789, (636,176), root:(637,229), state 0x0, keycode 9 (keysym 0xff1b, Escape), same_screen YES, XLookupString gives 1 bytes: (1b) " mbLookupString gives 1 bytes: (1b) " FilterEvent returns: False

KeyRelease event, serial 36, synthetic NO, window 0x1c00001, root 0x579, subw 0x0, time 593789, (636,176), root:(637,229), state 0x0, keycode 9 (keysym 0xff1b, Escape), same_screen YES, XLookupString gives 1 bytes: (1b) " FilterEvent returns: False

KeyPress event, serial 36, synthetic NO, window 0x1c00001, root 0x579, subw 0x0, time 593789, (636,176), root:(637,229), state 0x0, keycode 34 (keysym 0x5b, bracketleft), same_screen YES, XLookupString gives 1 bytes: (5b) "[" XmbLookupString gives 1 bytes: (5b) "[" XFilterEvent returns: False

KeyRelease event, serial 36, synthetic NO, window 0x1c00001, root 0x579, subw 0x0, time 593789, (636,176), root:(637,229), state 0x0, keycode 34 (keysym 0x5b, bracketleft), same_screen YES, XLookupString gives 1 bytes: (5b) "[" XFilterEvent returns: False

KeyPress event, serial 36, synthetic NO, window 0x1c00001, root 0x579, subw 0x0, time 593789, (636,176), root:(637,229), state 0x0, keycode 10 (keysym 0x31, 1), same_screen YES, XLookupString gives 1 bytes: (31) "1" XmbLookupString gives 1 bytes: (31) "1" XFilterEvent returns: False

KeyRelease event, serial 36, synthetic NO, window 0x1c00001, root 0x579, subw 0x0, time 593789, (636,176), root:(637,229), state 0x0, keycode 10 (keysym 0x31, 1), same_screen YES, XLookupString gives 1 bytes: (31) "1" XFilterEvent returns: False

KeyPress event, serial 36, synthetic NO, window 0x1c00001, root 0x579, subw 0x0, time 593789, (636,176), root:(637,229), state 0x0, keycode 17 (keysym 0x38, 8), same_screen YES, XLookupString gives 1 bytes: (38) "8" XmbLookupString gives 1 bytes: (38) "8" XFilterEvent returns: False

KeyRelease event, serial 36, synthetic NO, window 0x1c00001, root 0x579, subw 0x0, time 593789, (636,176), root:(637,229), state 0x0, keycode 17 (keysym 0x38, 8), same_screen YES, XLookupString gives 1 bytes: (38) "8" XFilterEvent returns: False

KeyPress event, serial 36, synthetic NO, window 0x1c00001, root 0x579, subw 0x0, time 593789, (636,176), root:(637,229), state 0x0, keycode 47 (keysym 0x3b, semicolon), same_screen YES, XLookupString gives 1 bytes: (3b) ";" XmbLookupString gives 1 bytes: (3b) ";" XFilterEvent returns: False

KeyRelease event, serial 36, synthetic NO, window 0x1c00001, root 0x579, subw 0x0, time 593789, (636,176), root:(637,229), state 0x0, keycode 47 (keysym 0x3b, semicolon), same_screen YES, XLookupString gives 1 bytes: (3b) ";" XFilterEvent returns: False

KeyPress event, serial 36, synthetic NO, window 0x1c00001, root 0x579, subw 0x0, time 593789, (636,176), root:(637,229), state 0x0, keycode 15 (keysym 0x36, 6), same_screen YES, XLookupString gives 1 bytes: (36) "6" XmbLookupString gives 1 bytes: (36) "6" XFilterEvent returns: False

KeyRelease event, serial 36, synthetic NO, window 0x1c00001, root 0x579, subw 0x0, time 593789, (636,176), root:(637,229), state 0x0, keycode 15 (keysym 0x36, 6), same_screen YES, XLookupString gives 1 bytes: (36) "6" XFilterEvent returns: False

KeyPress event, serial 36, synthetic NO, window 0x1c00001, root 0x579, subw 0x0, time 593789, (636,176), root:(637,229), state 0x0, keycode 50 (keysym 0xffe1, Shift_L), same_screen YES, XLookupString gives 0 bytes: XmbLookupString gives 0 bytes: XFilterEvent returns: False

KeyPress event, serial 36, synthetic NO, window 0x1c00001, root 0x579, subw 0x0, time 593789, (636,176), root:(637,229), state 0x1, keycode 49 (keysym 0x7e, asciitilde), same_screen YES, XLookupString gives 1 bytes: (7e) "~" XmbLookupString gives 1 bytes: (7e) "~" XFilterEvent returns: False

KeyRelease event, serial 36, synthetic NO, window 0x1c00001, root 0x579, subw 0x0, time 593789, (636,176), root:(637,229), state 0x1, keycode 49 (keysym 0x7e, asciitilde), same_screen YES, XLookupString gives 1 bytes: (7e) "~" XFilterEvent returns: False

KeyRelease event, serial 36, synthetic NO, window 0x1c00001, root 0x579, subw 0x0, time 593789, (636,176), root:(637,229), state 0x1, keycode 50 (keysym 0xffe1, Shift_L), same_screen YES, XLookupString gives 0 bytes: XFilterEvent returns: False

KeyPress event, serial 36, synthetic NO, window 0x1c00001, root 0x579, subw 0x0, time 593789, (636,176), root:(637,229), state 0x0, keycode 37 (keysym 0xffe3, Control_L), same_screen YES, XLookupString gives 0 bytes: XmbLookupString gives 0 bytes: XFilterEvent returns: False

KeyRelease event, serial 36, synthetic NO, window 0x1c00001, root 0x579, subw 0x0, time 594021, (636,176), root:(637,229), state 0x4, keycode 37 (keysym 0xffe3, Control_L), same_screen YES, XLookupString gives 0 bytes: XFilterEvent returns: False

3. When I press `ctrl-shift-;`, The transfer sequence `esc [1;6R` was not sent correctly

KeyPress event, serial 36, synthetic NO, window 0x1000001, root 0x579, subw 0x0, time 1722927, (748,201), root:(749,254), state 0x0, keycode 37 (keysym 0xffe3, Control_L), same_screen YES, XLookupString gives 0 bytes: XmbLookupString gives 0 bytes: XFilterEvent returns: False

KeyPress event, serial 36, synthetic NO, window 0x1000001, root 0x579, subw 0x0, time 1722967, (748,201), root:(749,254), state 0x4, keycode 50 (keysym 0xffe1, Shift_L), same_screen YES, XLookupString gives 0 bytes: XmbLookupString gives 0 bytes: XFilterEvent returns: False

KeyRelease event, serial 36, synthetic NO, window 0x1000001, root 0x579, subw 0x0, time 1723007, (748,201), root:(749,254), state 0x5, keycode 37 (keysym 0xffe3, Control_L), same_screen YES, XLookupString gives 0 bytes: XFilterEvent returns: False

KeyPress event, serial 36, synthetic NO, window 0x1000001, root 0x579, subw 0x0, time 1723007, (748,201), root:(749,254), state 0x1, keycode 9 (keysym 0xff1b, Escape), same_screen YES, XLookupString gives 1 bytes: (1b) " mbLookupString gives 1 bytes: (1b) " FilterEvent returns: False

KeyRelease event, serial 36, synthetic NO, window 0x1000001, root 0x579, subw 0x0, time 1723007, (748,201), root:(749,254), state 0x1, keycode 9 (keysym 0xff1b, Escape), same_screen YES, XLookupString gives 1 bytes: (1b) " FilterEvent returns: False

KeyPress event, serial 36, synthetic NO, window 0x1000001, root 0x579, subw 0x0, time 1723007, (748,201), root:(749,254), state 0x1, keycode 34 (keysym 0x7b, braceleft), same_screen YES, XLookupString gives 1 bytes: (7b) "{" XmbLookupString gives 1 bytes: (7b) "{" XFilterEvent returns: False

KeyRelease event, serial 36, synthetic NO, window 0x1000001, root 0x579, subw 0x0, time 1723007, (748,201), root:(749,254), state 0x1, keycode 34 (keysym 0x7b, braceleft), same_screen YES, XLookupString gives 1 bytes: (7b) "{" XFilterEvent returns: False

KeyPress event, serial 36, synthetic NO, window 0x1000001, root 0x579, subw 0x0, time 1723007, (748,201), root:(749,254), state 0x1, keycode 11 (keysym 0x40, at), same_screen YES, XLookupString gives 1 bytes: (40) "@" XmbLookupString gives 1 bytes: (40) "@" XFilterEvent returns: False

KeyRelease event, serial 36, synthetic NO, window 0x1000001, root 0x579, subw 0x0, time 1723007, (748,201), root:(749,254), state 0x1, keycode 11 (keysym 0x40, at), same_screen YES, XLookupString gives 1 bytes: (40) "@" XFilterEvent returns: False

KeyPress event, serial 36, synthetic NO, window 0x1000001, root 0x579, subw 0x0, time 1723007, (748,201), root:(749,254), state 0x1, keycode 19 (keysym 0x29, parenright), same_screen YES, XKeysymToKeycode returns keycode: 188 XLookupString gives 1 bytes: (29) ")" XmbLookupString gives 1 bytes: (29) ")" XFilterEvent returns: False

KeyRelease event, serial 36, synthetic NO, window 0x1000001, root 0x579, subw 0x0, time 1723007, (748,201), root:(749,254), state 0x1, keycode 19 (keysym 0x29, parenright), same_screen YES, XKeysymToKeycode returns keycode: 188 XLookupString gives 1 bytes: (29) ")" XFilterEvent returns: False

KeyPress event, serial 36, synthetic NO, window 0x1000001, root 0x579, subw 0x0, time 1723007, (748,201), root:(749,254), state 0x1, keycode 47 (keysym 0x3a, colon), same_screen YES, XLookupString gives 1 bytes: (3a) ":" XmbLookupString gives 1 bytes: (3a) ":" XFilterEvent returns: False

KeyRelease event, serial 36, synthetic NO, window 0x1000001, root 0x579, subw 0x0, time 1723007, (748,201), root:(749,254), state 0x1, keycode 47 (keysym 0x3a, colon), same_screen YES, XLookupString gives 1 bytes: (3a) ":" XFilterEvent returns: False

KeyPress event, serial 36, synthetic NO, window 0x1000001, root 0x579, subw 0x0, time 1723007, (748,201), root:(749,254), state 0x1, keycode 15 (keysym 0x5e, asciicircum), same_screen YES, XLookupString gives 1 bytes: (5e) "^" XmbLookupString gives 1 bytes: (5e) "^" XFilterEvent returns: False

KeyRelease event, serial 36, synthetic NO, window 0x1000001, root 0x579, subw 0x0, time 1723007, (748,201), root:(749,254), state 0x1, keycode 15 (keysym 0x5e, asciicircum), same_screen YES, XLookupString gives 1 bytes: (5e) "^" XFilterEvent returns: False

KeyPress event, serial 36, synthetic NO, window 0x1000001, root 0x579, subw 0x0, time 1723007, (748,201), root:(749,254), state 0x1, keycode 49 (keysym 0x7e, asciitilde), same_screen YES, XLookupString gives 1 bytes: (7e) "~" XmbLookupString gives 1 bytes: (7e) "~" XFilterEvent returns: False

KeyRelease event, serial 36, synthetic NO, window 0x1000001, root 0x579, subw 0x0, time 1723007, (748,201), root:(749,254), state 0x1, keycode 49 (keysym 0x7e, asciitilde), same_screen YES, XLookupString gives 1 bytes: (7e) "~" XFilterEvent returns: False

KeyPress event, serial 36, synthetic NO, window 0x1000001, root 0x579, subw 0x0, time 1723007, (748,201), root:(749,254), state 0x1, keycode 37 (keysym 0xffe3, Control_L), same_screen YES, XLookupString gives 0 bytes: XmbLookupString gives 0 bytes: XFilterEvent returns: False

KeyRelease event, serial 36, synthetic NO, window 0x1000001, root 0x579, subw 0x0, time 1723327, (748,201), root:(749,254), state 0x5, keycode 37 (keysym 0xffe3, Control_L), same_screen YES, XLookupString gives 0 bytes: XFilterEvent returns: False

KeyRelease event, serial 36, synthetic NO, window 0x1000001, root 0x579, subw 0x0, time 1723327, (748,201), root:(749,254), state 0x1, keycode 50 (keysym 0xffe1, Shift_L), same_screen YES, XLookupString gives 0 bytes: XFilterEvent returns: False


3. When I press `shift-enter`, 4 extra `shift_l` are sent,

KeyPress event, serial 36, synthetic NO, window 0x1000001, root 0x579, subw 0x0, time 310809, (636,176), root:(637,229), state 0x0, keycode 50 (keysym 0xffe1, Shift_L), same_screen YES, XLookupString gives 0 bytes: XmbLookupString gives 0 bytes: XFilterEvent returns: False

KeyRelease event, serial 36, synthetic NO, window 0x1000001, root 0x579, subw 0x0, time 310889, (636,176), root:(637,229), state 0x1, keycode 50 (keysym 0xffe1, Shift_L), same_screen YES, XLookupString gives 0 bytes: XFilterEvent returns: False

KeyPress event, serial 36, synthetic NO, window 0x1000001, root 0x579, subw 0x0, time 310889, (636,176), root:(637,229), state 0x0, keycode 9 (keysym 0xff1b, Escape), same_screen YES, XLookupString gives 1 bytes: (1b) " mbLookupString gives 1 bytes: (1b) " FilterEvent returns: False

KeyRelease event, serial 36, synthetic NO, window 0x1000001, root 0x579, subw 0x0, time 310889, (636,176), root:(637,229), state 0x0, keycode 9 (keysym 0xff1b, Escape), same_screen YES, XLookupString gives 1 bytes: (1b) " FilterEvent returns: False

KeyPress event, serial 36, synthetic NO, window 0x1000001, root 0x579, subw 0x0, time 310889, (636,176), root:(637,229), state 0x0, keycode 34 (keysym 0x5b, bracketleft), same_screen YES, XLookupString gives 1 bytes: (5b) "[" XmbLookupString gives 1 bytes: (5b) "[" XFilterEvent returns: False

KeyRelease event, serial 36, synthetic NO, window 0x1000001, root 0x579, subw 0x0, time 310889, (636,176), root:(637,229), state 0x0, keycode 34 (keysym 0x5b, bracketleft), same_screen YES, XLookupString gives 1 bytes: (5b) "[" XFilterEvent returns: False

KeyPress event, serial 36, synthetic NO, window 0x1000001, root 0x579, subw 0x0, time 310889, (636,176), root:(637,229), state 0x0, keycode 10 (keysym 0x31, 1), same_screen YES, XLookupString gives 1 bytes: (31) "1" XmbLookupString gives 1 bytes: (31) "1" XFilterEvent returns: False

KeyRelease event, serial 36, synthetic NO, window 0x1000001, root 0x579, subw 0x0, time 310889, (636,176), root:(637,229), state 0x0, keycode 10 (keysym 0x31, 1), same_screen YES, XLookupString gives 1 bytes: (31) "1" XFilterEvent returns: False

KeyPress event, serial 36, synthetic NO, window 0x1000001, root 0x579, subw 0x0, time 310889, (636,176), root:(637,229), state 0x0, keycode 16 (keysym 0x37, 7), same_screen YES, XLookupString gives 1 bytes: (37) "7" XmbLookupString gives 1 bytes: (37) "7" XFilterEvent returns: False

KeyRelease event, serial 36, synthetic NO, window 0x1000001, root 0x579, subw 0x0, time 310889, (636,176), root:(637,229), state 0x0, keycode 16 (keysym 0x37, 7), same_screen YES, XLookupString gives 1 bytes: (37) "7" XFilterEvent returns: False

KeyPress event, serial 36, synthetic NO, window 0x1000001, root 0x579, subw 0x0, time 310889, (636,176), root:(637,229), state 0x0, keycode 47 (keysym 0x3b, semicolon), same_screen YES, XLookupString gives 1 bytes: (3b) ";" XmbLookupString gives 1 bytes: (3b) ";" XFilterEvent returns: False

KeyRelease event, serial 36, synthetic NO, window 0x1000001, root 0x579, subw 0x0, time 310889, (636,176), root:(637,229), state 0x0, keycode 47 (keysym 0x3b, semicolon), same_screen YES, XLookupString gives 1 bytes: (3b) ";" XFilterEvent returns: False

KeyPress event, serial 36, synthetic NO, window 0x1000001, root 0x579, subw 0x0, time 310889, (636,176), root:(637,229), state 0x0, keycode 14 (keysym 0x35, 5), same_screen YES, XLookupString gives 1 bytes: (35) "5" XmbLookupString gives 1 bytes: (35) "5" XFilterEvent returns: False

KeyRelease event, serial 36, synthetic NO, window 0x1000001, root 0x579, subw 0x0, time 310889, (636,176), root:(637,229), state 0x0, keycode 14 (keysym 0x35, 5), same_screen YES, XLookupString gives 1 bytes: (35) "5" XFilterEvent returns: False

KeyPress event, serial 36, synthetic NO, window 0x1000001, root 0x579, subw 0x0, time 310889, (636,176), root:(637,229), state 0x0, keycode 50 (keysym 0xffe1, Shift_L), same_screen YES, XLookupString gives 0 bytes: XmbLookupString gives 0 bytes: XFilterEvent returns: False

KeyPress event, serial 36, synthetic NO, window 0x1000001, root 0x579, subw 0x0, time 310889, (636,176), root:(637,229), state 0x1, keycode 49 (keysym 0x7e, asciitilde), same_screen YES, XLookupString gives 1 bytes: (7e) "~" XmbLookupString gives 1 bytes: (7e) "~" XFilterEvent returns: False

KeyRelease event, serial 36, synthetic NO, window 0x1000001, root 0x579, subw 0x0, time 310889, (636,176), root:(637,229), state 0x1, keycode 49 (keysym 0x7e, asciitilde), same_screen YES, XLookupString gives 1 bytes: (7e) "~" XFilterEvent returns: False

KeyRelease event, serial 36, synthetic NO, window 0x1000001, root 0x579, subw 0x0, time 311105, (636,176), root:(637,229), state 0x1, keycode 50 (keysym 0xffe1, Shift_L), same_screen YES, XLookupString gives 0 bytes: XFilterEvent returns: False

rvaiya commented 2 years ago

When I press ctrl-enter, I get the following keystroke event(Captured by xev). [...]

In the future please post the output of keyd -m, it is much more concise. It would also help if you could only post the relevant portion of the config.

As you can see, keyd sends 4 additional control_l and 2 shift_l

To summarize, the problematic portion of your config is equivalent to:

[customControl:C]
enter = macro(esc [18;6~)

and the output is:

Control_L down
Control_L up
Escape down
Escape up
bracketleft down
bracketleft up
1 down
1 up
8 down
8 up
semicolon down
semicolon up
6 down
6 up
Shift_L down
asciitilde down
asciitilde up
Shift_L up
Control_L down
Control_L up

The output is precisely what you should expect. I'm not sure what the 'additional shift' you're referring to is. Your macro contains ~ which necessarily produces the only shift key in the output. The control down/up events are present because you have bound the macro within a control layer, they should not affect the output.

I think part of your problem might stem from some misapprehensions about terminal input. ANSI sequences need to be written to the TTY. Input from your keyboard is generated by your terminal emulator as output from the TTY. You can't directly input special characters from your keyboard and expect the terminal to act on them. If you want an escaped statement suitable for use in things like printf then you probably want something like macro(\\033[31m) instead.

yyy33 commented 2 years ago

When I press ctrl-enter, I get the following keystroke event(Captured by xev). [...]

In the future please post the output of keyd -m, it is much more concise. It would also help if you could only post the relevant portion of the config.

As you can see, keyd sends 4 additional control_l and 2 shift_l

To summarize, the problematic portion of your config is equivalent to:

[customControl:C]
enter = macro(esc [18;6~)

and the output is:

Control_L down
Control_L up
Escape down
Escape up
bracketleft down
bracketleft up
1 down
1 up
8 down
8 up
semicolon down
semicolon up
6 down
6 up
Shift_L down
asciitilde down
asciitilde up
Shift_L up
Control_L down
Control_L up

The output is precisely what you should expect. I'm not sure what the 'additional shift' you're referring to is. Your macro contains ~ which necessarily produces the only shift key in the output. The control down/up events are present because you have bound the macro within a control layer, they should not affect the output.

I think part of your problem might stem from some misapprehensions about terminal input. ANSI sequences need to be written to the TTY. Input from your keyboard is generated by your terminal emulator as output from the TTY. You can't directly input special characters from your keyboard and expect the terminal to act on them. If you want an escaped statement suitable for use in things like printf then you probably want something like macro(\\033[31m) instead.

  1. For example, this part of my configuration
    
    [main]
    leftshift = layer(leftshift{alacritty})

[leftshift{alacritty}:S] enter = macro(esc [17;5~)


2. When I press `shift-enter`, the event I detect is this, but I think the first line of `leftshift up` and the second line of `leftshift down` should not exist

leftshift down leftshift up esc down esc up [ down [ up 1 down 1 up 7 down 7 up ; down ; up 5 down 5 up leftshift down down up leftshift up

rvaiya commented 2 years ago

:S makes leftshift{alacritty} (incidentally you really should be using keyd-application-mapper) behave like shift. This means as soon as you press it shift down is emitted. It is a feature (not a bug). It should not have any effect on what you are trying to achieve in this instance.

yyy33 commented 2 years ago

I am using fcitx input method and bound shift to activate/disable it, the first and second events are detected by fcitx, so it is always activated or disabled every time I press shift-enter.

I think I may do some configuration in awesome wm, use different layout for different application by keyd ipc, not that keyd-application-mapper is bad, I just want to run as few things as possible, my computer performance is relatively low

yyy33 commented 2 years ago

:S makes leftshift{alacritty} (incidentally you really should be using keyd-application-mapper) behave like shift. This means as soon as you press it shift down is emitted. It is a feature (not a bug). It should not have any effect on what you are trying to achieve in this instance.

  1. I found that my composite layer configuration is also not working properly, for example, the following configuration
    [capslock{alacritty}+alt]
    h = macro(esc [1;3S)
  2. When I press capslock+alt+h, I get the following event,which esc [1;3S become esc [1;4R,And there are two more events leftalt down and leftalt up
    
    leftalt down
    esc down
    esc up
    [ down
    [ up
    1 down
    1 up
    ; down
    ; up
    4 down
    4 up
    leftshift down
    r down
    r up
    leftshift up
    leftalt up
rvaiya commented 2 years ago

I am using fcitx input method and bound shift to activate/disable it, the first and second events are detected by fcitx, so it is always activated or disabled every time I press shift-enter.

Then there is an inherent conflict in your bindings. You either want to avoid :S or (better) remap your fcitx key and then use overload within keyd to remap your left shift key to produce it on tap.

I think I may do some configuration in awesome wm, use different layout for different application by keyd ipc, not that keyd-application-mapper is bad, I just want to run as few things as possible, my computer performance is relatively low

Unless you are trying to avoid installing python, you are better off using the shipped option. The script is interrupt driven and spends most of its time waiting for X events (like awesome), using the awesome's IPC functionality doesn't avoid this (it just adds another socket between you and the X server).

When I press capslock+alt+h, I get the following event,which esc [1;3S

That is the expected output given your config. Please reread the man page (hint: you've rebound leftalt).

I am going to close this for now, since it involves several different issues and is not a bug.

yyy33 commented 2 years ago

I am using fcitx input method and bound shift to activate/disable it, the first and second events are detected by fcitx, so it is always activated or disabled every time I press shift-enter.

Then there is an inherent conflict in your bindings. You either want to avoid :S or (better) remap your fcitx key and then use overload within keyd to remap your left shift key to produce it on tap.

I think I may do some configuration in awesome wm, use different layout for different application by keyd ipc, not that keyd-application-mapper is bad, I just want to run as few things as possible, my computer performance is relatively low

Unless you are trying to avoid installing python, you are better off using the shipped option. The script is interrupt driven and spends most of its time waiting for X events (like awesome), using the awesome's IPC functionality doesn't avoid this (it just adds another socket between you and the X server).

When I press capslock+alt+h, I get the following event,which esc [1;3S

That is the expected output given your config. Please reread the man page (hint: you've rebound leftalt).

I am going to close this for now, since it involves several different issues and is not a bug.

Thank you for your help and I will try your suggestions