Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Cannot bind [Alt-]Shift-Tab via [A-]S-Tab #163

Closed
bi4k8 opened this issue Dec 14, 2021 · 5 comments
Closed

Cannot bind [Alt-]Shift-Tab via [A-]S-Tab #163

bi4k8 opened this issue Dec 14, 2021 · 5 comments

Comments

@bi4k8
Copy link

bi4k8 commented Dec 14, 2021

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.

@droc12345
Copy link
Contributor

droc12345 commented Dec 14, 2021

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?

@blobject
Copy link

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.

@Consolatis
Copy link
Member

Consolatis commented Feb 24, 2023

See #365 (comment) 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.

@johanmalm
Copy link
Collaborator

johanmalm added a commit to johanmalm/labwc that referenced this issue Jul 17, 2023
When looking up keybinds, if the translated keysyms (based on the keymap
for the keyboard) do not match a defined keybind, try raw keysyms (as if
there were no modifier translation).

This allows a user to define for example keybind with "S-1" rather than
"S-exclam". It also supports "W-S-Tab".

Fixes: issues labwc#163 labwc#365 labwc#992
johanmalm added a commit that referenced this issue Jul 18, 2023
When looking up keybinds, if the translated keysyms (based on the keymap
for the keyboard) do not match a defined keybind, try raw keysyms (as if
there were no modifier translation).

This allows a user to define for example keybind with "S-1" rather than
"S-exclam". It also supports "W-S-Tab".

Fixes: issues #163 #365 #992
@Consolatis
Copy link
Member

Should be fixed by

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

5 participants