You are not logged in.

#1 2020-01-23 18:19:34

cyberpunkrocker
Member
From: Birckala, Finland
Registered: 2019-09-16
Posts: 24
Website

System automatically resets keyboard mapping after some time

I have a small, but very annoying problem with Arch Linux...

If I leave the computer running untouched for some time (about 2 hours, plus/minus half an hour; I haven't really measured the time), the keyboard mapping is reset back to default 'us' from the user setting 'fi'. I use 'setxkbmap -layout fi' to set the mapping layout, originally in .xinitrc, but I moved it to .bashrc to be able to quickly re-reset keyboard map by opening a terminal.

This is not desktop environment or window manager-specific, or even architecture-specific issue, because the same happens on two quite different machines: a normal x86_64 desktop using Awesome WM, and a Raspberry Pi 4 using i3 WM. The issue is somewhere deeper in the system.

Which braindead mechanism is behind this behavior, and how can I disable it - permanently?

Offline

#2 2020-01-23 19:25:59

ewaller
Administrator
From: Pasadena, CA
Registered: 2009-07-13
Posts: 19,785

Re: System automatically resets keyboard mapping after some time

Any thing of interest in the logs that might provide clues?
Is this the same keyboard?  Bluetooth?  USB?

No ideas yet, but dredging for more information.


Nothing is too wonderful to be true, if it be consistent with the laws of nature -- Michael Faraday
Sometimes it is the people no one can imagine anything of who do the things no one can imagine. -- Alan Turing
---
How to Ask Questions the Smart Way

Offline

#3 2020-01-23 20:44:32

cyberpunkrocker
Member
From: Birckala, Finland
Registered: 2019-09-16
Posts: 24
Website

Re: System automatically resets keyboard mapping after some time

Well, as for the logs, I don't know where to start looking. Journald helpfully obscures all the logs so it's difficult  to find anything. But I'll try.
The keyboard is USB on the desktop, bluetooth on the RPi.

Offline

#4 2020-01-23 20:56:26

Ropid
Member
Registered: 2015-03-09
Posts: 1,069

Re: System automatically resets keyboard mapping after some time

I'm guessing the keyboard disconnects and reconnects for some reason. Maybe it's a powersaving feature?

You can set the keyboard layout in an Xorg config file. The Xorg server will then apply the change whenever a keyboard connects, without you having to run a script.

There's a command "localectl" that comes with systemd that helps write that Xorg config file. Its command line looks like this:

localectl set-x11-keymap LAYOUT [MODEL [VARIANT [OPTIONS]]]

If you just want a "fi" layout, you would run this:

sudo localectl set-x11-keymap fi

The tool will write a file "/etc/X11/xorg.conf.d/00-keyboard.conf".

Last edited by Ropid (2020-01-23 20:57:46)

Offline

#5 2020-01-23 21:35:52

cyberpunkrocker
Member
From: Birckala, Finland
Registered: 2019-09-16
Posts: 24
Website

Re: System automatically resets keyboard mapping after some time

I suspect that at least on RPi it doesn't have anything to do with powersaving. I disabled bluetooth powersaving a long time ago because it kept putting my BT mouse to sleep after just 1-2 seconds of inactivity. Wiggling it awake every time became annoying very fast.

I have already considered the xorg-config option, but even if it works, it doesn't explain why the "automatic" reset happens now.

I'll do some tests tomorrow; now I have to go to sleep, it's almost midnight here.

Offline

#6 2020-01-28 13:28:14

cyberpunkrocker
Member
From: Birckala, Finland
Registered: 2019-09-16
Posts: 24
Website

Re: System automatically resets keyboard mapping after some time

I think I have now pinpointed the troublemaker, although I still don't understand the how and the why: gnome-control-center.

The gnome-control-center was installed only as a dependency, I have since used it only once or twice. But I noticed that the keyboard section in Region & Language was left undefined, so I set it to the correct keyboard model. That is now the only change in effect, and the keyboard layout stays correct regardless of how long I wait... So, it was the gnome-control-center, or some program/process/daemon related to it, which kept changing the layout behind my back!!!
What I still don't understand is why it kicked in only after a long period of inactivity.

Is this a bug which I should report somewhere, or is this just a typically idiotic Gnome "feature"?

Offline

Board footer

Powered by FluxBB