labwc icon indicating copy to clipboard operation
labwc copied to clipboard

Cannot bind [Alt-]Shift-Tab via `[A-]S-Tab`

Open bi4k8 opened this issue 4 years ago • 1 comments

Something is off in the way we handle xkb keysyms for key bindings. Because Shift+Tab produces the ISO_Left_Tab keysym, S-Tab cannot be bound to keybinds.

I've locally worked around this with the following patch, but I don't have much confidence that it's the right way to fix things:

diff --git a/src/keyboard.c b/src/keyboard.c
index b0b8b56..84c3392 100644
--- a/src/keyboard.c
+++ b/src/keyboard.c
@@ -116,6 +116,9 @@ handle_compositor_keybindings(struct wl_listener *listener,
                }
        }
 
+       xkb_layout_index_t layout = xkb_state_key_get_layout (device->keyboard->xkb_state, keycode);
+       nsyms = xkb_keymap_key_get_syms_by_level(device->keyboard->keymap, keycode, layout, 0, &syms);
+
        if (server->cycle_view) {
                damage_all_outputs(server);
                if (event->state == WL_KEYBOARD_KEY_STATE_PRESSED) {

We should reference how other compositors do keycode→keysym mapping for internal hotkeys.

bi4k8 avatar Dec 14 '21 02:12 bi4k8

Shift-Tab should treated as a key with a modifier, instead of just looking at the sym value. Not sure how many potential key combinations, that we want to use, are like this. If it was just this one, then working around it would be easy.

Edit to add: How do we handle shift (1-0) or shift keypad?

droc12345 avatar Dec 14 '21 13:12 droc12345

I noticed that W-S-1 doesn't work, but that W-S-exclam does. Not sure how relevant this is to the issue though.

blobject avatar Feb 23 '23 22:02 blobject

See https://github.com/labwc/labwc/issues/365#issuecomment-1159221562 for a workaround.

We should really figure this out at some point and implement a proper fix. Sadly both, time and motivation are scarce goods in many FOSS projects. Any help would be appreciated.

For this specific case of W-S-Tab: using W-S-ISO_Left_Tab should work.

Consolatis avatar Feb 24 '23 13:02 Consolatis

Raw keysyms I think.

https://github.com/swaywm/sway/blob/9498e4d2614fce6b29b64fd8a3861c1fb5be4b87/sway/input/keyboard.c#L305-L323

johanmalm avatar Feb 24 '23 19:02 johanmalm

Should be fixed by

  • #997

Note: the workaround keybinds will have preference over raw ones, e.g. W-S-0x21 would get used if defined and W-S-1 would not be used at all. Thus suggesting to replace all workaround keybinds with proper ones. Feel free to open a new issue if there are any further issues with the keybinds.

Consolatis avatar Jul 18 '23 19:07 Consolatis