SUMMARY ( Reposted from https://mail.kde.org/pipermail/kde-linux/2020-October/011349.html because I did not get any reply after over a month and all my web searches were not fruitful. ) Hi all! How can I change the xkb map/keyboard layout / etc. in plasma5 + kwin + wayland? I was able to configure it in sway+wayland right away (see: https://github.com/shlomif/shlomif-computer-settings/blob/c90640879bb3f7aeddd4344125f88aa6b236a815/shlomif-settings/sway/sway/config#L228 ) and I spent several hours trying to do the same in plasma5 + wayland to no avail. ``` [shlomif at localhost ~]$ localectl status System Locale: LANG=en_US.UTF-8 VC Keymap: us-acentos X11 Layout: us,il X11 Model: pc105 X11 Variant: ,lyx X11 Options: compose:ralt,grp:switch,grp:alt_shift_toggle,grp_led:scroll [shlomif at localhost ~]$ ``` (after a reboot) ``` [shlomif at localhost ~]$ cat .config/kxkbrc [Layout] DisplayNames=, LayoutList=us,il(lyx) LayoutLoopCount=-1 Model= ResetOldOptions=false ShowFlag=false ShowLabel=true ShowLayoutIndicator=true ShowSingle=false SwitchMode=Global Use=true [shlomif at localhost ~]$ ``` tried this too: ``` #! /bin/sh # # apply-hebrew-keymap-for-wayland.sh # Copyright (C) 2020 Shlomi Fish <shlomif at cpan.org> # # Distributed under the terms of the MIT / Expat license. # localectl set-x11-keymap \ 'us,il' \ 'pc105' \ ",lyx" \ "compose:ralt,grp:switch,grp:alt_shift_toggle,grp_led:scroll" \ ``` also tried the ibus applet. The keyboard works fine in plasma5 + x11 + startx. I am using: ``` System: Host: fedora Kernel: 5.9.8-200.fc33.x86_64 x86_64 bits: 64 Desktop: KDE Plasma 5.19.5 Distro: Fedora release 33 (Thirty Three) CPU: Info: Quad Core model: Intel Core i5-8259U bits: 64 type: MT MCP L2 cache: 6144 KiB Speed: 3722 MHz min/max: 400/3800 MHz Core speeds (MHz): 1: 3771 2: 3782 3: 3781 4: 3715 5: 3748 6: 3797 7: 3792 8: 3750 Graphics: Device-1: Intel Iris Plus Graphics 655 driver: i915 v: kernel Display: server: Fedora Project X.org 1.20.9 driver: modesetting unloaded: fbdev,vesa resolution: 1920x1080~60Hz OpenGL: renderer: Mesa Intel Iris Plus Graphics 655 (CFL GT3) v: 4.6 Mesa 20.2.2 ``` I tried searching the web using duckduckgo and google and didn't find anything. Also tried asking on several freenode chatrooms. What should I do? I'll be content with the keyboard configuration being assigned at plasma5's session startup and not changeable at runtime. Note that I'd prefer a solution where there is some code (in Python/etc.) to mutate some ~/.config/k* files, so I'll be able to run it without a manual GUI process. Regards, Shlomi
What do you want exactly? * Just switching the keyboard layout? * Switching the keyboard layout via terminal? * Creating a custom keyboard layout? If it's just switching the keyboard layout, that can be done by adding one in System Settings > Input devices > Keyboard. Then there should be a new widget on your tray + a keyboard shortcut to switch at will (Ctrl+Alt+K).
Hi Thiago! Thanks for the reply. (In reply to Thiago Sueto from comment #1) > What do you want exactly? > * Just switching the keyboard layout? > * Switching the keyboard layout via terminal? Yes, I want to switch the xkbmap / keyboard layout, either from the terminal or programatically (by writing C++ code/etc.) and to the one I desire it to be (= us+il+compose key) *and* on wayland. > * Creating a custom keyboard layout? > > If it's just switching the keyboard layout, that can be done by adding one > in System Settings > Input devices > Keyboard. Then there should be a new > widget on your tray + a keyboard shortcut to switch at will (Ctrl+Alt+K). I'd rather not use a gui for that because it will mean i'll have to perform it time and time again in every new unix user, virtual machine, or new computer.
XKB is an upstream project and no KDE code is needed to switch XKB settings; such tools are already built into XKB and its command-line utilities. I would recommend reading the manpage for xkbcli.