OneDeadKey / kalamine

Keyboard Layout Maker
MIT License
103 stars 29 forks source link

[xkb] KDE Plasma (Wayland) does not support layouts in `~/.config/xkb` #124

Open fabi1cazenave opened 6 months ago

fabi1cazenave commented 6 months ago

A possible workaround would be to set environment variables to select keyboard layouts explicitely :

# ~/.config/plasma-workspace/env/setkeymap.sh
export QT_LOGGING_RULES="kwin_*.debug=true"
export XKB_LOG_VERBOSITY=10
export KWIN_XKB_DEFAULT_KEYMAP=yes
export XKB_DEFAULT_LAYOUT=fr,us
export XKB_DEFAULT_VARIANT=ergol,altgr-intl
export XKB_DEFAULT_OPTIONS=# les options que tu veux
export XKB_CONTEXT_NO_SECURE_GETENV=yes

Related KDE bugs :

gagbo commented 6 months ago

It definitely works like that. The 2 main issues are:

fabi1cazenave commented 6 months ago

This means that :

I assume ksettings can see these layouts in /usr/share/X11/xkb/symbols ?

fabi1cazenave commented 6 months ago

TIL : KDE not supporting XKB layouts is not a bug, it’s a feature.

KWIN_XKB_DEFAULT_KEYMAP This environment variable forces the xkb integration on Wayland to use a default keymap instead of using the configured one. Mostly required for testing. This environment variable is supported since 5.8.

https://community.kde.org/KWin/Environment_Variables#KWIN_XKB_DEFAULT_KEYMAP

wismill commented 6 months ago

Mostly required for testing.

So the workaround above is confirmed to be a big hack.

fabi1cazenave commented 6 months ago

Seriously, KDE ?

I really don’t get it. Why would a DE ever want to rely on its own magic rather than XKB for keyboard management ?

wismill commented 6 months ago

The issue is that they have their own rules parser. So there are currently 2 workarounds:

  1. The hack above
  2. Editing directly ~/.config/kxkbrc. The GUI configuration then does display the right config, but becomes buggy if you change it. I do not see Kalamine modifying this file, but for me it’s a better workaround than the first one.
fabi1cazenave commented 6 months ago

If their parser supports /usr/share/X11/xkb/rules properly, I think we should just consider KDE as not compatible with ~/.config/xkb yet and make kalamine refuse to install layouts in user space when KDE is running — even if Wayland is detected.

So I guess we mostly have to inpect a KDE-specific environment variable and let kalamine decide accordingly ?

fabi1cazenave commented 6 months ago

I’m a bit worried though. Is it okay to consider that all Wayland desktop environments properly support ~/.config/xkb, and that KDE is just an exception ? Or should we take it the other way around, and only white-list DEs for which a proper ~/.config/xkb support has been confirmed ?

wismill commented 6 months ago

No idea. I would say it depends if they use xkbcommon-registry. I would say yes for all DE designed for Wayland from the beginning. For the others… your mileage may vary!

RichardFevrier commented 4 months ago

Seems to be fixed for the next plasma release.