More than one keyboard layout is causing errors on Manjaro KDE

I originally had a Colemak layout as my main keyboard in Manjaro KDE, though keyboard layouts in settings. Later I added a Russian layout as secondary keyboard layout, and some of the “colemak” keys (in other words, the non-standard keys like f - r - s - t) were in English, instead of the Russian characters like they should be.

So I just removed all the layouts and set up a single US keyboard layout, but those same keys don’t output anything now. If I go back to Colemak, it works like it should.

If I do it manually with setxkbmap -layout us or setxkbmap -layout ru in the command line then it works fine.

I have the same issues with other layouts, like Spanish or whatever. I just want a second keyboard in another language that works automatically on startup. Any suggestions on how to fix this short of reinstalling Manjaro?

I found the issue. My .Xmodmap was overriding f, r, s, and t on all my keyboard layouts because I have them mapped to arrow keys.

It should switch when you switch keyboard layouts, because it works when I do it manually on the command line. But for some .Xmodmap is independent of whatever keyboard layout you choose on KDE, at least on Manjaro.

My solution was just to create a keyboard shortcut that changes the keyboard layout manually on the command line, and it fixed all these weird conflicts I was getting from trying to have it do this on startup.

This forum is pretty dead though. I mean, in the end maybe it wasn’t so much a Manjaro issue as a KDE and Linux issue, but I’ll look elsewhere for solutions next time.

It’s usually best to keep related questions in one thread. Creating multiple threads likely will not increase the chances of your content being noticed, or indeed, elicit greater response.

The forum is seldom ever empty. I imagine it was simply a case that nobody had an answer for you. However, I’m glad you managed to find a solution.

Cheers.

Also, to the best of my knowledge, it should not be possible to use two separate keyboard layouts concurrently - as the errors presented during boot would tend to make obvious. The best workaround is possibly something like you have already found to change the keyboard layout only temporarily.

2 Likes

If you’d mentioned that you’d tried to customise things, it probably would’ve pointed us in the right direction.

xmodmap was deprecated a long, long time ago.

The real solution is to remove ~/.Xmodmap…if you want to customise things, see below.

Sounds like misconfiguration, using deprecated software. xmodmap comes from a time before groups, so it’s unlikely to handle them well.

When you use setxkbmap or xmodmap, you’re changing the config.

When you switch groups you only change which part of the config you’re using. You don’t change the config itself.

So it seems that your xmodmap config is breaking things, and you undo it by using setxkbmap (which is a replacement for xmodmap).

This is the proper way to customise a layout for X:

# Copy the layout
sudo cp -a /usr/share/X11/xkb/symbols/ru{,_mine}

# Make your changes
sudo nano /usr/share/X11/xkb/symbols/ru_mine

# Test it
setxkbmap -layout ru_mine

Obviously, repeat for each layout you want to edit.

You can use localectl to make it permanent. You can also use the GUI, but only if you save your layout as custom, unfortunately there’s only one custom so it only works for a single layout, but you could combine up to 4 layouts into a single layout by using groups.

https://wiki.archlinux.org/title/Xorg/Keyboard_configuration#Using_localectl

Unless you actually want to use two keyboards, in which case AFAIK you’ll need a systemd service (and for external devices, also a udev rule) to run setxkbmap for each extra device.

The forum was pretty active, your thread was dead.

When that happens it’s because no one has anything useful to say…or the few people that do, have missed it. Usually the OP didn’t give enough information to figure it out and/or was confusing.

Next time use evtest and/or xev -event keyboard to see what’s happening…if you ask for help, post the output. If you do then you should get some replies.

@soundofthunder

Then you should read the man pages for xkbcomp and setxkbmap, though the effect is as you say temporary (same with xmodmap). Unfortunately it seems wayland is backwards in this regard.

# xkbcomp
-i deviceid
        If source or destination is a valid X display, load the keymap from/into the device with the specified ID (not name).

# setxkbmap
-device device
        Specifies the numeric device id of the input device to be updated with the new keyboard layout. If not specified, the core keyboard device of the X server is updated

However, I think the OP is actually using a single keyboard, and confusingly referred to a layout as a keyboard once or twice, but I could be wrong.


Sorry for the long post.

Are you suggesting two layouts can be active and used at the same time with one keyboard?

No, I’m saying it’s “possible to use two separate keyboard layouts concurrently”, by using them with two keyboards.

Perhaps I missed some context.

Maybe so, but yes, with two keyboards (virtual plus physical, for example) that should be possible. Perhaps I missed something also; the presumption being that the OP was using only one keyboard, which isn’t actually specified.