sway
sway copied to clipboard
`--input-device` makes `bindsym` echo keys
Running Arch Linux, sway version 1.7. I use multiple keyboards (a built-in one, and an external programmable one), and I have a different set of keybindings for each. As such, I decided to specify --input-device for every bindsym invocation. Turns out that adding --input-device subtly changes the behavior of the binding: activations of keyboard-specific bindings are not consumed by sway, and get passed down to applications.
Steps
- Open Sway.
- Check the current keyboard (e.g. via
swaymsg -t get_inputs). - Add a new binding specific to the keyboard (e.g.
swaymsg bindsym --input-device=<ID> Mod4+a nop). - Add a new binding for all keyboards (e.g.
swaymsg bindsym Mod4+b nop). - Open a program such as
fishinsidekitty(cat -vis likely the best bet -fishcan be configured to handleESC). - Try both keybindings.
- Note that the keyboard-specific one results in input to the program (e.g.
[97;9uis printed), where as the non-specific one does not.
Configuration
Here is a sample configuration file which shows this issue (replace <ID> appropriately):
bindsym Mod4+t exec kitty
bindsym Mod4+e exit
bindsym --input-device=<ID> Mod4+a nop
bindsym Mod4+b nop
Simply open Sway with this file, activate Mod4+t, (open cat -v), Mod4+a, Mod4+b, note the difference in output, close the shell, and exit with Mod4+e.
Log
I have a log, but due to the excess amount of low-level information therein, I would rather not upload it. Here are what appear to be the most relevant snippets:
00:00:00.064 [INFO] [sway/config.c:407] Loading config from config
00:00:00.064 [DEBUG] [sway/config.c:824] Read line 1: bindsym Mod4+t exec kitty
00:00:00.064 [INFO] [sway/commands.c:378] Config command: bindsym Mod4+t exec kitty
00:00:00.064 [INFO] [sway/commands.c:398] After replacement: bindsym Mod4+t exec kitty
00:00:00.064 [DEBUG] [sway/commands/bind.c:298] bindsym - Bound Mod4+t to command `exec kitty` for device '*'
00:00:00.064 [DEBUG] [sway/config.c:824] Read line 2: bindsym Mod4+e exit
00:00:00.064 [INFO] [sway/commands.c:378] Config command: bindsym Mod4+e exit
00:00:00.064 [INFO] [sway/commands.c:398] After replacement: bindsym Mod4+e exit
00:00:00.064 [DEBUG] [sway/commands/bind.c:298] bindsym - Bound Mod4+e to command `exit` for device '*'
00:00:00.064 [DEBUG] [sway/config.c:824] Read line 3: bindsym --input-device=<ID> Mod4+a nop
00:00:00.064 [INFO] [sway/commands.c:378] Config command: bindsym --input-device=<ID> Mod4+a nop
00:00:00.064 [INFO] [sway/commands.c:398] After replacement: bindsym --input-device=<ID> Mod4+a nop
00:00:00.064 [DEBUG] [sway/commands/bind.c:298] bindsym - Bound Mod4+a to command `nop` for device '<ID>'
00:00:00.064 [DEBUG] [sway/config.c:824] Read line 4: bindsym Mod4+b nop
00:00:00.064 [INFO] [sway/commands.c:378] Config command: bindsym Mod4+b nop
00:00:00.064 [INFO] [sway/commands.c:398] After replacement: bindsym Mod4+b nop
00:00:00.064 [DEBUG] [sway/commands/bind.c:298] bindsym - Bound Mod4+b to command `nop` for device '*'
...
00:00:05.264 [DEBUG] [sway/commands/bind.c:617] running command for binding: nop
00:00:05.264 [INFO] [sway/commands.c:258] Handling command 'nop'
00:00:06.648 [DEBUG] [sway/commands/bind.c:617] running command for binding: nop
00:00:06.648 [INFO] [sway/commands.c:258] Handling command 'nop'
I have the same issue, and I think it's actually a duplicate of #4955. In any case, adding seat * keyboard_grouping none in my config fixed it for me.
(Sway 1.7, Arch Linux, using internal laptop keyboard in fr-oss layout and external keyboard with a custom US-based layout)
In any case, adding
seat * keyboard_grouping nonein my config fixed it for me.
Thanks for the workaround, works for me too !