how to alter the keyboard layout?

Duncan 1i5t5.duncan at
Tue Mar 1 22:11:52 GMT 2022

hw posted on Sun, 27 Feb 2022 17:42:56 +0100 as excerpted:

> On Sun, 2022-02-27 at 08:42 +0000, Duncan wrote:
>> hw posted on Sat, 26 Feb 2022 15:58:22 +0100 as excerpted:
>> > Hi,
>> > 
>> > how do I alter the keyboard layout for plasma on wayland sessions?
>> > 
>> > I need to put Alt on the left menu key, a dot on the Delete key on
>> > the number pad (instead of a comma) and a slash on the '+' key (wich
>> > is right to the 'ΓΌ' key)?  I used to do that with an xmodmap,
>> > but of course that doesn't work anymore with wayland.
>> > 
>> > There must be files somewhere that define all the various keyboard
>> > layouts you can pick from, but where are they?  That kind of
>> > information must not be hidden from the users and should be shown in
>> > the settings ...
>> Some of that can be configured in plasma's systemsettings, hardware,
>> input devices, keyboard, advanced.  (That's where it is on live-git
>> plasma, anyway, specific path may differ on old plasma.)
> So how do I make the changes I described through that?  It doesn't seem
> possible at all.
>> There's an expander for alt and win key behavior, and another for
>> numeric keypad delete behavior.  I expect they'll do what you need.
> Like I said, I need an Alt key on the right side of the keyboard (space
> bar). There is nothing in the keyboard settings that would allow me to
> alter the keyboard layout except for pre-defined stuff which doesn't
> work for this and which I don't have access to because there is no way
> to know where this is defined.  Maybe it's hardcoded?

FWIW AFAIK the available options are what were called layout variant 
options under X.  They are boolean options that can be added to any 
layout, so work well as the checkboxes that plasma systemsettings 
implements them as.  That's why there's a limited number of them -- 
they're all the layout variant options for X and there's a limited number 
of /them/.

Meanwhile, actually you said you needed Alt on the Left Menu key.  See the 
quote above.  Now you're saying you need it on the right side.  But at 
least on the standard US QWERTY as expanded by MS with Win and Menu keys, 
there's only a single Menu key, right side of keyboard, tho often two Win 
keys (tho my Logitech has the right Win key replaced by a Logitech 
proprietary Function key so it can eliminate keys like scroll-lock and the 
Menu key and Function-key-stack them on other keys, so it only has the 
left Win key).  And there's already two Alt keys, immediately to each side 
of the space bar.

So now I'm quite confused.  Never-the-less, at least _some_ Alt key 
options are available, including for example, Alt mapped to Right Win, 
Super to Menu, which would be right side, and Alt swapped with Win, which 
would seem to swap them wherever they are on they keyboard.

These options are under the Alt and Win behavior expander in the location 
already mentioned (systemsettings, hardware, input devices, keyboard, 

Meanwhile, numeric keypad delete behavior is under the expander by that 
name.  I definitely see among the options there both of the ones you 

Legacy key with comma (which you have, perhaps as part of your selected 
primary layout, and don't want).

Legacy key with dot (which is what you said you wanted).

So that one should definitely be possible.

Slash on the + key... OK, you're definitely not using the US-QWERTY layout 
I'm using here because the US keyboard doesn't have that "weird U key" (I 
could select/paste from above but why bother, the result is the same, in 
the US it's "a weird U key/character") at all.

That one I don't have the foggiest.

>> Beyond that, I've seen /hints/ that some of the X tools still work for
>> keyboard config, etc, and of course there's libinput's standardization
>> which is based on the older evdev.  But my knowledge is limited enough
>> on that that you can probably google it as efficiently as I could,
>> so...
> From what I've found, they probably don't work for wayland because they
> are for X.  Why can't we just change our keyboard layouts as we need to?
>  It could be so simple, but nowadays everything is made ridiculously
> complicated for no reason at all ...

Well, the one way I *know* will work is to change the libinput layout 
configuration, and/or the kernel terminal level mapping.  That should work 
the same regardless of what graphics environment you're using, because 
it's at a level below X/wayland both that they both build on equally.  I'm 
*definitely* not an authority on it, but with both of them using the 
libinput keyboard driver change its config and you change the input both X 
and wayland see, period.

At minimum you can either switch layouts if you can find one that suits 
you, or, rather more low-level config, define your own layout just like 
the various national and hardware layouts are defined.  Actually, chances 
are once you find the layout definition for what you're actually using 
now, you'll only need to change the definitions of the few keys and 
possibly recompile it and be good to go. That's actually the level I 
alluded to above (at least one level below the xmodmap you mentioned) that 
I've seen hints is still used, tho I don't know enough about it for the 
hints to make any real practical sense to me in terms of how I'd actually 
edit it or which tools /are/ actually still used, so I can't in turn post 
anything beyond that about it that makes sense, because I don't understand 
it any further than that myself.

If I needed it badly enough I'm sure I could google it up and figure it 
out in a night or three, but I've not needed it myself, certainly not 
needed it badly enough to raise the priority high enough to actually do 
it, which is why I said you could do the same just as well as I could, 
since you /do/ seem to need it badly enough.  Then you could post the info 
and I'd know too, in case I needed it either for myself some time from 
now, or for the next person that I come across that needs it.  Plus all 
the various googles (google itself and others, like duck duck go, which I 
prefer due to the highly invasive tracking actual google itself does) 
would probably get ahold of it too, and if the explanation was good 
enough, it'd start showing up for others to google.

Duncan - List replies preferred.   No HTML msgs.
"Every nonfree program has a lord, a master --
and if you use the program, he is your master."  Richard Stallman

More information about the kde mailing list