kovidgoyal / kitty

Cross-platform, fast, feature-rich, GPU based terminal
https://sw.kovidgoyal.net/kitty/
GNU General Public License v3.0
24.12k stars 972 forks source link

Dead keys not working on Wayland #6187

Closed fdev31 closed 1 year ago

fdev31 commented 1 year ago

Everything was working for me until I recently switched to wayland (hyprland). Since then the dead keys (like "^" or "¨" in a French keyboard) just do nothing on Kitty. Very similar as #171 , but for wayland only.

Steps to reproduce the behavior:

  1. Press ^
  2. Press (space)
  3. A ^ character should be displayed, instead we get a space.

Environment details

DISTRIB_ID="Arch" DISTRIB_RELEASE="rolling" DISTRIB_DESCRIPTION="Arch Linux" Running under: Wayland Frozen: False Paths: kitty: /usr/bin/kitty base dir: /usr/lib/kitty extensions dir: /usr/lib/kitty/kitty system shell: /bin/zsh Loaded config files: /home/fab/.config/kitty/kitty.conf

Config options different from defaults: allow_remote_control yes background_opacity 0.9 editor nvim enable_audio_bell False focus_follows_mouse True font_family Fira Code Regular font_features: {'FiraCode-Regular': ('+ss01', '+ss02', '+ss03', '+ss04', '+ss05', '+ss07', '+ss08', '+zero', '+cv30', '+cv18')} font_size 8.0 tab_bar_style powerline tab_separator | visual_bell_duration 0.1 window_border_width (1.0, 'pt') Added shortcuts: kitty_mod+alt+left → move_tab_backward kitty_mod+alt+n → move_window_forward kitty_mod+alt+p → move_window_backward kitty_mod+alt+right → move_tab_forward kitty_mod+p > o → kitten hints --type path --program vim kitty_mod+p > u → kitten hints Changed shortcuts: ctrl+shift+tab → previous_window kitty_mod+h → pipe @ansi overlay less +G -R -i kitty_mod+n → next_window kitty_mod+t → new_tab_with_cwd !neighbor Colors: background #202020
color0 #151515
color1 #ac4142
color10 #7e8d50
color11 #e5b566
color12 #6c99ba
color13 #9e4e85
color14 #7dd5cf
color15 #f5f5f5
color2 #7e8d50
color3 #e5b566
color4 #6c99ba
color5 #9e4e85
color6 #7dd5cf
color7 #d0d0d0
color8 #505050
color9 #ac4142
cursor #d0d0d0
foreground #d0d0d0
selection_background #eecb8b
selection_foreground #232323

Important environment variables seen by the kitty process: PATH /home/fab/dev/qtile/bin:/home/fab/utils:/usr/local/sbin:/usr/local/bin:/usr/bin:/opt/android-sdk/cmdline-tools/latest/bin:/opt/cuda/bin:/opt/cuda/nsight_compute:/opt/cuda/nsight_systems/bin:/opt/flutter/bin:/usr/lib/jvm/default/bin:/usr/bin/site_perl:/usr/bin/vendor_perl:/usr/bin/core_perl:/home/fab/.local/bin:/sbin:/usr/sbin:/usr/local/bin:/home/fab/.pub-cache/bin:./node_modules/.bin/:/home/fab/.android-sdk/cmdline-tools/latest/bin:/home/fab/.android-sdk/platform-tools:/home/fab/.android-sdk/tools:/opt/android-sdk/cmdline-tools/latest/bin:/opt/cuda/bin:/opt/cuda/nsight_compute:/opt/cuda/nsight_systems/bin:/opt/flutter/bin:/home/fab/.fzf/bin LANG fr_FR.UTF-8 VISUAL nvim EDITOR nvim SHELL /bin/zsh DISPLAY :0 WAYLAND_DISPLAY wayland-1 USER fab XCURSOR_SIZE 32 XDG_BACKEND wayland LC_ADDRESS
LC_NAME
LC_MONETARY
XDG_SEAT seat0 XDG_SESSION_TYPE wayland LC_PAPER
XDG_CURRENT_DESKTOP Hyprland XDG_SESSION_CLASS user LC_IDENTIFICATION
LC_TELEPHONE
LC_MESSAGES
LC_MEASUREMENT
XDG_VTNR 2 XDG_SESSION_ID 8 LC_CTYPE
XDG_RUNTIME_DIR /run/user/1000 LC_TIME
LC_COLLATE
LC_NUMERIC C


**Additional context**
with --debug-input I capture the following log:

Press xkb_keycode: 0x1a clean_sym: dead_circumflex composed_sym: dead_circumflex mods: none glfw_key: 0 (UNKNd 1.4.4-1 (+8 0.53) rminal 0.4.0-1 (103.5 KiB 395.1 KiB) [lxde lxity/banner 1.3.2-10 (14.7 KiB 88.3 KiB) OWN) xkb_key: 65106 (dead_circumflex) alternate_key: 91 ([)mmunity/ytfzf 2.5.5-1 (71.9 KiB 208.1 KiB) is a simple to configure Gemini serv) (Obsolète : 2017-07-28) on_key_input: glfw key: 0x0 native_code: 0xfe52 action: PRESS mods: none text: '' state: 0 ignoring as keyboard mode does not support encoding this event python-beautifultable 1.1.0-1 (48.7 KiB 290.5 KiB) using ANSI escape sequences. P/Mattermost/Slack/Matrix/etc) tallé) ) Release xkb_keycode: 0x1a clean_sym: dead_circumflex mods: none glfw_key: 0 (UNKNOWN) xkb_ke y: 65106 (dead_circumflex) alternate_key: 91 ([) penPose: Real-time multi-person keypoint dr/failsafewm 0.0.2-1 (+3 0.00) on_key_input: glfw key: 0x0 native_code: 0xfe52 action: RELEASE mods: none text: '' state: 0 ignoring release event for previous press that was handled as sho sed MUA for the notmuch mail system it 20210323.c075e16-1 (+1 0ined 2022.27-1 (+12 0.16)

kovidgoyal commented 1 year ago

kitty uses the exact same code in wayland as x11. If dead keys are not working then its because the compositor is not sending proper events for them. I can tell you they work fine in most compositors. Use --debug-input to see what keys events are sent to kitty.

fdev31 commented 1 year ago

I did, it is in the bottom part of the bug report. Can you please have a look ? Kitty is the only app which ignores those dead keys.

kovidgoyal commented 1 year ago

That output is mixed up with output from something else. Run kitty from within kitty like this

kitty --debug-input

Press a complete key sequence that reproduces the problem, then quit kitty and post the full log. And post what keyboard layout you are using and what keys you pressed on the keyboard to generate the log.

fdev31 commented 1 year ago

Ok, here is a sequence of "^":

❯ kitty --debug-input
[106 09:38:38.847878] Ignoring unknown config key: remote_kitty
Loading new XKB keymaps
xkbcommon: ERROR: Couldn't read Compose file /usr/share/X11/locale/: Aucun périphérique de ce type
[106 09:38:38.908017] [glfw error 65544]: Failed to create XKB compose table for locale 
Modifier indices alt: 0x3 super: 0x6 hyper: 0xffffffff meta: 0xffffffff numlock: 0x4 shift: 0x0 capslock: 0x1 control: 0x2

text-input: updating IME focus state, focused: 1

text-input: updating cursor position: left=2 top=2 width=7 height=14
[106 09:38:38.933767] [glfw error 65544]: process_desktop_settings: failed with error: [org.freedesktop.DBus.Error.UnknownMethod] L’interface « org.freedesktop.portal.Settings » n’existe pas pour l’objet à l’emplacement /org/freedesktop/portal/desktop

text-input: updating IME focus state, focused: 1

text-input: updating IME focus state, focused: 1

text-input: updating IME focus state, focused: 1

text-input: updating IME focus state, focused: 1
[106 09:38:38.946932] [PARSE ERROR] Unknown OSC code: 1337
[106 09:38:38.946941] [PARSE ERROR] Unknown OSC code: 1337
[106 09:38:38.946943] [PARSE ERROR] Unknown OSC code: 1337
[106 09:38:38.946946] [PARSE ERROR] Unknown OSC code: 1337
Press xkb_keycode: 0x1a clean_sym: dead_circumflex composed_sym: dead_circumflex mods: none glfw_key: 0 (UNKNOWN) xkb_key: 65106 (dead_circumflex) alternate_key: 91 ([)
on_key_input: glfw key: 0x0 native_code: 0xfe52 action: PRESS mods: none text: '' state: 0 
text-input: updating cursor position: left=50 top=4 width=7 height=14
ignoring as keyboard mode does not support encoding this event
Release xkb_keycode: 0x1a clean_sym: dead_circumflex mods: none glfw_key: 0 (UNKNOWN) xkb_key: 65106 (dead_circumflex) alternate_key: 91 ([)
on_key_input: glfw key: 0x0 native_code: 0xfe52 action: RELEASE mods: none text: '' state: 0 ignoring release event for previous press that was handled as shortcut
Press xkb_keycode: 0x1a clean_sym: dead_circumflex composed_sym: dead_circumflex mods: none glfw_key: 0 (UNKNOWN) xkb_key: 65106 (dead_circumflex) alternate_key: 91 ([)
on_key_input: glfw key: 0x0 native_code: 0xfe52 action: PRESS mods: none text: '' state: 0 ignoring as keyboard mode does not support encoding this event
Release xkb_keycode: 0x1a clean_sym: dead_circumflex mods: none glfw_key: 0 (UNKNOWN) xkb_key: 65106 (dead_circumflex) alternate_key: 91 ([)
on_key_input: glfw key: 0x0 native_code: 0xfe52 action: RELEASE mods: none text: '' state: 0 ignoring release event for previous press that was handled as shortcut
Press xkb_keycode: 0x1a clean_sym: dead_circumflex composed_sym: dead_circumflex mods: none glfw_key: 0 (UNKNOWN) xkb_key: 65106 (dead_circumflex) alternate_key: 91 ([)
on_key_input: glfw key: 0x0 native_code: 0xfe52 action: PRESS mods: none text: '' state: 0 ignoring as keyboard mode does not support encoding this event
Release xkb_keycode: 0x1a clean_sym: dead_circumflex mods: none glfw_key: 0 (UNKNOWN) xkb_key: 65106 (dead_circumflex) alternate_key: 91 ([)
on_key_input: glfw key: 0x0 native_code: 0xfe52 action: RELEASE mods: none text: '' state: 0 ignoring release event for previous press that was handled as shortcut
Press xkb_keycode: 0x1a clean_sym: dead_circumflex composed_sym: dead_circumflex mods: none glfw_key: 0 (UNKNOWN) xkb_key: 65106 (dead_circumflex) alternate_key: 91 ([)
on_key_input: glfw key: 0x0 native_code: 0xfe52 action: PRESS mods: none text: '' state: 0 ignoring as keyboard mode does not support encoding this event
Release xkb_keycode: 0x1a clean_sym: dead_circumflex mods: none glfw_key: 0 (UNKNOWN) xkb_key: 65106 (dead_circumflex) alternate_key: 91 ([)
on_key_input: glfw key: 0x0 native_code: 0xfe52 action: RELEASE mods: none text: '' state: 0 ignoring release event for previous press that was handled as shortcut
Press xkb_keycode: 0x1a clean_sym: dead_circumflex composed_sym: dead_circumflex mods: none glfw_key: 0 (UNKNOWN) xkb_key: 65106 (dead_circumflex) alternate_key: 91 ([)
on_key_input: glfw key: 0x0 native_code: 0xfe52 action: PRESS mods: none text: '' state: 0 ignoring as keyboard mode does not support encoding this event
Release xkb_keycode: 0x1a clean_sym: dead_circumflex mods: none glfw_key: 0 (UNKNOWN) xkb_key: 65106 (dead_circumflex) alternate_key: 91 ([)
on_key_input: glfw key: 0x0 native_code: 0xfe52 action: RELEASE mods: none text: '' state: 0 ignoring release event for previous press that was handled as shortcut
Press xkb_keycode: 0x1a clean_sym: dead_circumflex composed_sym: dead_circumflex mods: none glfw_key: 0 (UNKNOWN) xkb_key: 65106 (dead_circumflex) alternate_key: 91 ([)
on_key_input: glfw key: 0x0 native_code: 0xfe52 action: PRESS mods: none text: '' state: 0 ignoring as keyboard mode does not support encoding this event
Release xkb_keycode: 0x1a clean_sym: dead_circumflex mods: none glfw_key: 0 (UNKNOWN) xkb_key: 65106 (dead_circumflex) alternate_key: 91 ([)
on_key_input: glfw key: 0x0 native_code: 0xfe52 action: RELEASE mods: none text: '' state: 0 ignoring release event for previous press that was handled as shortcut
Press xkb_keycode: 0x1a clean_sym: dead_circumflex composed_sym: dead_circumflex mods: none glfw_key: 0 (UNKNOWN) xkb_key: 65106 (dead_circumflex) alternate_key: 91 ([)
on_key_input: glfw key: 0x0 native_code: 0xfe52 action: PRESS mods: none text: '' state: 0 ignoring as keyboard mode does not support encoding this event
Release xkb_keycode: 0x1a clean_sym: dead_circumflex mods: none glfw_key: 0 (UNKNOWN) xkb_key: 65106 (dead_circumflex) alternate_key: 91 ([)
on_key_input: glfw key: 0x0 native_code: 0xfe52 action: RELEASE mods: none text: '' state: 0 ignoring release event for previous press that was handled as shortcut
Press xkb_keycode: 0x1a clean_sym: dead_circumflex composed_sym: dead_circumflex mods: none glfw_key: 0 (UNKNOWN) xkb_key: 65106 (dead_circumflex) alternate_key: 91 ([)
on_key_input: glfw key: 0x0 native_code: 0xfe52 action: PRESS mods: none text: '' state: 0 ignoring as keyboard mode does not support encoding this event
Release xkb_keycode: 0x1a clean_sym: dead_circumflex mods: none glfw_key: 0 (UNKNOWN) xkb_key: 65106 (dead_circumflex) alternate_key: 91 ([)
on_key_input: glfw key: 0x0 native_code: 0xfe52 action: RELEASE mods: none text: '' state: 0 ignoring release event for previous press that was handled as shortcut
Press xkb_keycode: 0x1a clean_sym: dead_circumflex composed_sym: dead_circumflex mods: none glfw_key: 0 (UNKNOWN) xkb_key: 65106 (dead_circumflex) alternate_key: 91 ([)
on_key_input: glfw key: 0x0 native_code: 0xfe52 action: PRESS mods: none text: '' state: 0 ignoring as keyboard mode does not support encoding this event
Release xkb_keycode: 0x1a clean_sym: dead_circumflex mods: none glfw_key: 0 (UNKNOWN) xkb_key: 65106 (dead_circumflex) alternate_key: 91 ([)
on_key_input: glfw key: 0x0 native_code: 0xfe52 action: RELEASE mods: none text: '' state: 0 ignoring release event for previous press that was handled as shortcut
Press xkb_keycode: 0x1a clean_sym: dead_circumflex composed_sym: dead_circumflex mods: none glfw_key: 0 (UNKNOWN) xkb_key: 65106 (dead_circumflex) alternate_key: 91 ([)
on_key_input: glfw key: 0x0 native_code: 0xfe52 action: PRESS mods: none text: '' state: 0 ignoring as keyboard mode does not support encoding this event
Release xkb_keycode: 0x1a clean_sym: dead_circumflex mods: none glfw_key: 0 (UNKNOWN) xkb_key: 65106 (dead_circumflex) alternate_key: 91 ([)
on_key_input: glfw key: 0x0 native_code: 0xfe52 action: RELEASE mods: none text: '' state: 0 ignoring release event for previous press that was handled as shortcut
Press xkb_keycode: 0x1a clean_sym: dead_circumflex composed_sym: dead_circumflex mods: none glfw_key: 0 (UNKNOWN) xkb_key: 65106 (dead_circumflex) alternate_key: 91 ([)
on_key_input: glfw key: 0x0 native_code: 0xfe52 action: PRESS mods: none text: '' state: 0 ignoring as keyboard mode does not support encoding this event
Release xkb_keycode: 0x1a clean_sym: dead_circumflex mods: none glfw_key: 0 (UNKNOWN) xkb_key: 65106 (dead_circumflex) alternate_key: 91 ([)
on_key_input: glfw key: 0x0 native_code: 0xfe52 action: RELEASE mods: none text: '' state: 0 ignoring release event for previous press that was handled as shortcut
Press xkb_keycode: 0x1a clean_sym: dead_circumflex composed_sym: dead_circumflex mods: none glfw_key: 0 (UNKNOWN) xkb_key: 65106 (dead_circumflex) alternate_key: 91 ([)
on_key_input: glfw key: 0x0 native_code: 0xfe52 action: PRESS mods: none text: '' state: 0 ignoring as keyboard mode does not support encoding this event
Release xkb_keycode: 0x1a clean_sym: dead_circumflex mods: none glfw_key: 0 (UNKNOWN) xkb_key: 65106 (dead_circumflex) alternate_key: 91 ([)
on_key_input: glfw key: 0x0 native_code: 0xfe52 action: RELEASE mods: none text: '' state: 0 ignoring release event for previous press that was handled as shortcut
Press xkb_keycode: 0x1a clean_sym: dead_circumflex composed_sym: dead_circumflex mods: none glfw_key: 0 (UNKNOWN) xkb_key: 65106 (dead_circumflex) alternate_key: 91 ([)
on_key_input: glfw key: 0x0 native_code: 0xfe52 action: PRESS mods: none text: '' state: 0 ignoring as keyboard mode does not support encoding this event
Release xkb_keycode: 0x1a clean_sym: dead_circumflex mods: none glfw_key: 0 (UNKNOWN) xkb_key: 65106 (dead_circumflex) alternate_key: 91 ([)
on_key_input: glfw key: 0x0 native_code: 0xfe52 action: RELEASE mods: none text: '' state: 0 ignoring release event for previous press that was handled as shortcut
Press xkb_keycode: 0x1a clean_sym: dead_circumflex composed_sym: dead_circumflex mods: none glfw_key: 0 (UNKNOWN) xkb_key: 65106 (dead_circumflex) alternate_key: 91 ([)
on_key_input: glfw key: 0x0 native_code: 0xfe52 action: PRESS mods: none text: '' state: 0 ignoring as keyboard mode does not support encoding this event
Release xkb_keycode: 0x1a clean_sym: dead_circumflex mods: none glfw_key: 0 (UNKNOWN) xkb_key: 65106 (dead_circumflex) alternate_key: 91 ([)
on_key_input: glfw key: 0x0 native_code: 0xfe52 action: RELEASE mods: none text: '' state: 0 ignoring release event for previous press that was handled as shortcut
Press xkb_keycode: 0x1a clean_sym: dead_circumflex composed_sym: dead_circumflex mods: none glfw_key: 0 (UNKNOWN) xkb_key: 65106 (dead_circumflex) alternate_key: 91 ([)
on_key_input: glfw key: 0x0 native_code: 0xfe52 action: PRESS mods: none text: '' state: 0 ignoring as keyboard mode does not support encoding this event
Release xkb_keycode: 0x1a clean_sym: dead_circumflex mods: none glfw_key: 0 (UNKNOWN) xkb_key: 65106 (dead_circumflex) alternate_key: 91 ([)
on_key_input: glfw key: 0x0 native_code: 0xfe52 action: RELEASE mods: none text: '' state: 0 ignoring release event for previous press that was handled as shortcut
Press xkb_keycode: 0x1a clean_sym: dead_circumflex composed_sym: dead_circumflex mods: none glfw_key: 0 (UNKNOWN) xkb_key: 65106 (dead_circumflex) alternate_key: 91 ([)
on_key_input: glfw key: 0x0 native_code: 0xfe52 action: PRESS mods: none text: '' state: 0 ignoring as keyboard mode does not support encoding this event
Release xkb_keycode: 0x1a clean_sym: dead_circumflex mods: none glfw_key: 0 (UNKNOWN) xkb_key: 65106 (dead_circumflex) alternate_key: 91 ([)
on_key_input: glfw key: 0x0 native_code: 0xfe52 action: RELEASE mods: none text: '' state: 0 ignoring release event for previous press that was handled as shortcut
Press xkb_keycode: 0x1a clean_sym: dead_circumflex composed_sym: dead_circumflex mods: none glfw_key: 0 (UNKNOWN) xkb_key: 65106 (dead_circumflex) alternate_key: 91 ([)
on_key_input: glfw key: 0x0 native_code: 0xfe52 action: PRESS mods: none text: '' state: 0 ignoring as keyboard mode does not support encoding this event
Release xkb_keycode: 0x1a clean_sym: dead_circumflex mods: none glfw_key: 0 (UNKNOWN) xkb_key: 65106 (dead_circumflex) alternate_key: 91 ([)
on_key_input: glfw key: 0x0 native_code: 0xfe52 action: RELEASE mods: none text: '' state: 0 ignoring release event for previous press that was handled as shortcut
Press xkb_keycode: 0x1d clean_sym: Control_L composed_sym: Control_L mods: none glfw_key: 57442 (LEFT_CONTROL) xkb_key: 65507 (Control_L)
on_key_input: glfw key: 0xe062 native_code: 0xffe3 action: PRESS mods: none text: '' state: 0 ignoring as keyboard mode does not support encoding this event
fdev31 commented 1 year ago

The keyboard layout didn't change, still basic "fr" with no option. I'm new to wayland but it translates into hyprland config as such:

input {
    kb_layout = fr
    kb_variant =
    kb_model =
    kb_options =
    kb_rules =
kovidgoyal commented 1 year ago

Look at the errors near the top where libxkbcommon is failing to read the compose tables for your locale. That will be the cause. Make sure your local env vars are set correctly and the locale definition files are present on your system. And remember the env vars have to be set in whatever environment your are running kitty in, not inside the shell that is running in kitty.

kovidgoyal commented 1 year ago

https://bbs.archlinux.org/viewtopic.php?id=228658

fdev31 commented 1 year ago

Thank you! I wonder why this is an issue only with kitty but for trace (if someone have the same issue), I had to change my locale.conf to contain EVERY variable, from:

LANG=fr_FR.UTF-8
LC_NUMERIC=C

to

LANG=fr_FR.UTF-8
LC_CTYPE=fr_FR.UTF-8
LC_NUMERIC=C
LC_TIME=fr_FR.UTF-8
LC_COLLATE=fr_FR.UTF-8
LC_MONETARY=fr_FR.UTF-8
LC_MESSAGES=fr_FR.UTF-8
LC_PAPER=fr_FR.UTF-8
LC_NAME=fr_FR.UTF-8
LC_ADDRESS=fr_FR.UTF-8
LC_TELEPHONE=fr_FR.UTF-8
LC_MEASUREMENT=fr_FR.UTF-8
LC_IDENTIFICATION=fr_FR.UTF-8
fdev31 commented 1 year ago

I have the same issue again, but only when opening "unicode input" mode, and this time it's not dead keys but standard keys like "a" and "q"... they are not processed at all, with such trace:

Press xkb_keycode: 0x10 clean_sym: a composed_sym: a text: a mods: none glfw_key: 97 (a) xkb_key: 97 (a) alternate_key: 113 (q)
on_key_input: glfw key: 0x61 native_code: 0x61 action: PRESS mods: none text: 'a' state: 0 sent encoded key to child: ^[ [ 9 7 : : 1 1 3 ; ; 9 7 u 
Release xkb_keycode: 0x10 clean_sym: a mods: none glfw_key: 97 (a) xkb_key: 97 (a) alternate_key: 113 (q)
on_key_input: glfw key: 0x61 native_code: 0x61 action: RELEASE mods: none text: '' state: 0 ignoring as keyboard mode does not support encoding this event
kovidgoyal commented 1 year ago

Update to 0.28.1