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

XKB redirect actions are not correctly handled #554

Closed
benoit-pierre opened this issue May 19, 2018 · 3 comments
Closed

XKB redirect actions are not correctly handled #554

benoit-pierre opened this issue May 19, 2018 · 3 comments

Comments

@benoit-pierre
Copy link

For example the following mapping (which simulate a Shift+Insert) is not correctly handled:

 key <AB09> { [ NoSymbol, NoSymbol, NoSymbol, NoSymbol ], actions = [ NoAction(), NoAction(), Redirect(key= <INS>, mods=Shift, clearmods=Mod5) ] };

Similarly, my numlock-like layer does not work (see full keymap is here).

Possibly related libxkbcommon issue: xkbcommon/libxkbcommon#18

For now, I've monkeypatched my copy of kitty like this:

diff --git a/glfw/x11_window.c b/glfw/x11_window.c
index 63ad189..83105d3 100644
--- a/glfw/x11_window.c
+++ b/glfw/x11_window.c
@@ -1242,7 +1242,22 @@ static void processEvent(XEvent *event)
     {
         case KeyPress:
         {
+            XkbStateRec state_rec;
+
+            XkbGetState(_glfw.x11.display, XkbUseCoreKbd, &state_rec);
+
+            glfw_xkb_update_modifiers(
+                        &_glfw.x11.xkb,
+                        event->xkey.state, 0, 0,
+                        state_rec.base_group, state_rec.latched_group, state_rec.locked_group);
+
             glfw_xkb_handle_key_event(window, &_glfw.x11.xkb, event->xkey.keycode, GLFW_PRESS);
+
+            glfw_xkb_update_modifiers(
+                        &_glfw.x11.xkb,
+                        state_rec.base_mods, state_rec.latched_mods, state_rec.locked_mods,
+                        state_rec.base_group, state_rec.latched_group, state_rec.locked_group);
+
             return;
         }
 
@kovidgoyal
Copy link
Owner

Not sure what I can do about this. Fundamentally, unless libxkb adds support for Redirect, kitty cannot support it, as using various hacks to try to support it will break something else/be fragile.

Note that instead of monkey patching, you can use the send_text directive in kitty.conf to generate arbitrary bytes on arbitrary keypresses. Of course, thi will only work if the original key event is actually reaching kitty (which means it is a key that GLFW knows about).

@benoit-pierre
Copy link
Author

I looked at mapping the combo to paste_from_selection/paste_from_clipboard in kitty.conf but GLFW does not seem to know about the ISO_Level3_Shift modifier either...

@kovidgoyal
Copy link
Owner

If you search for compose in the closed kitty tickets there are some posts with people using the neo keyboard that uses a level 5 modifier (IIRC) and they were able to get it to work with kitty (at least after the changes I made to use libxkb).

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

2 participants