-
-
Notifications
You must be signed in to change notification settings - Fork 1k
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
Some dead keys does not work #171
Comments
Sorry I dont know much about dead keys on X11. What modifier keys do you press to generate them? |
I just press the key, then another characters and it show the characters with the accent (for example ^ + o = ô). After some research and test, it seems to be linked to how glfw handle event. |
Yes, glfw does not have support for dead keys/compose. It is on my TODO list to fork glfw and use a private copy anyway (there are various nice things I want that glfw does not eyt support and its development is very slow). If and when I do that adding support for dead keys via libxkbcommon should be easy. |
For reference: glfw/glfw#1140 |
Also relevant for vim. For instance - switching to the previous buffer using CTRL + SHIFT + ^ |
ctrl + shift + 6 should not generate anything. It would conflict with ctrl + 6. In most terminals they generate the same bytes. In kitty, ctrl+6 works, ctrl+shift+6 is ignored. Try running cat in any terminal and press ctrl+6 and then ctrl+shift+6 you will see they produce the same output. |
I have a potentially related problem. I use xcape to set my left alt key to ctrl+space if you tap it, which is my tmux prefix. I have been using this for years with urxvt and later termite. In trying out kitty, I found that this does not work, though manually pressing ctrl+space does. Even more strange, it seems to work once, the first time I start up kitty, and then never again until I open a new window, or something like that. |
Possibly related: With the neo keyboard the navigation (and delete) keys on Layer 3 refuse to function - even though all other keys an all 6 Layers worrk perfectly. |
Navigation keys on layer 5 for xkb (ISO_Level5_Shift) also do not work for me. |
Key Press Events: holding down the
Pressing
Releasing
Release
If I'm not mistaken one should ignore the modifier key inside the application in this case. Which in turrn seems to be the case for most keys except the following:
one that is non-relevant: |
Using xev isn't particularly useful. You'd need to use the tests/events.c program from glfw to see what keyboard events glfw sends, those are what kitty uses, not raw X11 events. Chances are you wont be able to fix this without modifying glfw, though. |
I fear you might be right. There probably is no keyboard agnostic workaround. The keypress event for the modifier gets logged, it however is not recognized at all
Then we have
And the Numpad seems to work because there is a seperation of input and keypresses:
|
Yeah this will need switching of glfw to use libxkb then glfw should behave similar to all other modern toolkits. I just need to find the time to do the glfw modification. I dont know if running under wayland is an option for you, but IIRC the glfw wayland backend unlike the X11 backend does use libxkb, so that might work for you. You can set the KITTY_ENABLE_WAYLAND=1 and WAYLAND_DISPLAY env vars to get kitty to use wayland. |
I don't know if it's related: I'm using kitty-term on gentoo and most of bash keyboard shortcut (ctrl-w ctrl-a ctrl-e backspace, ...) doesn't work once I ssh on another gentoo where kitty-term is not installed. There is several keyboard shortcuts that don't work locally and over SSH like it's "alt ." So the problem seems to be when using alt modifier, the keyboard mapping is not the good one if you're not using the qwerty one. |
@kovidgoyal I understand you want to work on this on your glfw fork, anyway I could contribute to that? I'm up for it (as it's literally the only thing keeping me from switching fully to kitty, which is awesome), but I would need a little bit of direction on where to look and what to touch 🙃 |
Absolutely. Simply fork glfw for yourself and make the changes. You can send the PR to the glfw project and regardless of whether they accept it or not, I can always merge it into my fork (which is what kitty uses). There are two stages of changes needed. To address the basic issue of not recognizing key mappings when using various X11 key mapping techniques, it should enough to simply switch to using libxkb to do the keybaord handling in the glfw X11 backend. You can look at the glfw wayland backend for inspiration, it uses libxkb already. The second, more broad stage is to create a new keyboard API in glfw which is needed long term for robust keyboard handling, this is discussed in glfw/glfw#1140 I suggest you work only on the first stage to start with, as it should be enough to address the vast majority of issues in this bug report. |
Well, I took a couple of days off to implement the new keyboard API in glfw. You can try it out in the xkb kitty branch. All the basic stuff seems to work, I haven't tested advanced features like compose, dead keys, changing keyboard layout on the fly though they should all work, the code for them is there. The major regression is that XIM (X Input Method) does not work. It did not work very well with the old keyboard API either and not at all in wayland, so I dont think the loss is too great. Try it out and let me know how it goes. Note that currently it is linux only, I still have to implement the new api for macOS. |
@rosshadden with the xkb branch of kitty your issue seems to be resolved. At elast, I tried running xcape -d the repeatedly pressing left ctrl in kitty running showkey -a and the output was
indicating that pressing left ctrl generated escape as expected. |
@ElricleNecro Your issue is also resolved. I tried the following:
Then in a newly opened kitty terminal (from the xkb branch) I pressed: Super_L, Shift + 6, o and got ô in kitty, as expected. |
@troubas I have no way of testing your issue since I dont have the neo keyboard. |
@kovidgoyal Thanks a lot for your work! If I run wayland (using the sway display manager) my keyboard loses about all of its functionality. Even the shift key no longer works =) However I think this needs to be adressed by the neo-developers and not you. Thanks again! Edit: Actually with your modified version running the xkb branch in a X11 environment all non-navigational keys work exactly the same as before. |
@troubas Run it with GLFW_DEBUG_KEYBOARD=1 and you should get output of what key events it is seeing, in that output the scancode will correspond to the keycode from xev. |
@kovidgoyal This looks promising? X11
Home, Left, Down, Right, End in that order:
and release the modifier
Wayland
And the same as above for X11 (less promising? ;)
|
Yeah looks like it might be made to work on X11 at least. Basically have to use the composed symbol rather than the clean symbol. Wayland is hopeless, since both are wrong. |
@kovidgoyal Awesome! I'll try out that branch when I get back from vacation. |
@troubas I pushed a commit that should take care of it on X11. Basically, when a modifier that glfw does not know about is active, it uses the shifted (composed) key instead of the unshifted (clean) key. |
@kovidgoyal jup navigation keys work now. Thank you good Sir! * pulls the hat * I noticed the |
@troubas |
Regarding #403, should or will fcitx (and/or other xim alternatives) be supported? |
Home and End work fine as far as I know. You might need to add some config to your shell to get it to read terminfo or add the bindings directly. For instance on zsh bindkey '\e[H' beginning-of-line
bindkey '\e[F' end-of-line
bindkey '\e[3~' delete-char XIM is not likely to be supported, as far as I know it does not work with libxkbcommon (they both read xcompose files for instance) and it is pretty flaky, read all the bug reports about XIM causing hangs/crashes. If you want to use it you will likely have to implement special support for it via dbus directly, like the other toolkits that support it do. That's a bit too much work for me, but patches are welcome. Personally, I would just use the Xcompose mechanism. It works on wayland as well. |
Regarding fcitx, better than using dbus would be to create a new kitten, like the unicode input kitten (ctrl+shift+u) that reads the fcitx data files and presents a nice terminal interface for input. THis would have the advantage of working on all platforms and probably being easier to implement, no need for DBUS. It depends on how complex the fcitx data format is. |
doh Added the zsh key-bindings and the home and end key work now. Thanks! 👍 |
Amazing! Now if this would also work on macOS I would be a happy camper 🙃 |
What would work on macOS? As far as I know the xkb branch works on macOS as well. |
Since no one has reported any outstanding issues (apart from XIM) I am merging into master and closing this bug report. |
I'm using |
Hmm I doubt remapping of modifiers for individual key presses is going to work with the way glfw functions. Modifier state is maintained independent of key presses. But you are welcome to take a stab at it, the relevant code is all in xkb_glfw.c, the two functions glfw_xkb_update_modifiers() and glfw_xkb_handle_key_event() |
Indeed, looking at the code, I dont see how a compose rule that changes the value of a modifier on an unrelated keypress would work with libxkbcommon at all. Modifiers are stored in a state object that is not touched by the libxkb compose API. |
Hi there.
The setxkbmap part works (ie CapsLock becomes Ctrl), but the 'xcape' part does not (ie tapping the CapsLock - now Ctrl - does not issue an ESC. I use this all the time in Zsh and Vim. Is there any way of fixing this problem. Thanks for any help, and thanks again for a great terminal emulator! Cheers from Canada! |
Hi!
Some dead keys (¨ and ^ to be precise) cannot be used anymore (they doesn't do anything). The problem seems to be specific to kitty as those key are working as expected using other terminal/applications.
I am using kitty (last git master) under arch linux with an azerty layout and a french (utf-8) locale.
The text was updated successfully, but these errors were encountered: