You are not logged in.

#1 2023-06-13 03:18:00

frabjous
Member
Registered: 2010-07-13
Posts: 367

xorg keyboard options/symbols only work temporarily

I have the following in my ~/.xinitrc in order to be able to use the Menu key on my keyboard as the Compose key, and to disable CapsLock.

# use menu key for compose
setxkbmap -option compose:menu

# disable capslock
setxkbmap -option caps:none

Setting these options like this works … for awhile. When I start my Window Manager (AwesomeWM), the menu key works for Compose, and CapsLock is disabled, as expected.

However, after awhile, the options just stop working. Somehow they get reset, and Menu no longer works as Compose, and CapsLock becomes re-enabled.

Here’s what the printout of the X keyboard settings looks like when things are working as expected.

$ setxkbmap -print -verbose 10
Setting verbose level to 10
locale is C
Trying to load rules file ./rules/evdev...
Trying to load rules file /usr/share/X11/xkb/rules/evdev...
Success.
Applied rules from evdev:
rules:      evdev
model:      pc105
layout:     us
options:    caps:none,compose:menu,compose:menu;caps:none
Trying to build keymap using the following components:
keycodes:   evdev+aliases(qwerty)
types:      complete
compat:     complete
symbols:    pc+us+inet(evdev)+capslock(none)+compose(menu)
geometry:   pc(pc105)
xkb_keymap {
        xkb_keycodes  { include "evdev+aliases(qwerty)" };
        xkb_types     { include "complete"      };
        xkb_compat    { include "complete"      };
        xkb_symbols   { include "pc+us+inet(evdev)+capslock(none)+compose(menu)"        };
        xkb_geometry  { include "pc(pc105)"     };
};

(I suspect the reason the two “options” are doubled when first listed is that I’ve also tried setting these these options globally with localectl in addition to what’s in my .xinitrc, but the problem predates my doing so, and obviously, it is still doing it.)

Here’s what the same output looks like when things are not working as expected.

$ setxkbmap -print -verbose 10
Setting verbose level to 10
locale is C
Trying to load rules file ./rules/evdev...
Trying to load rules file /usr/share/X11/xkb/rules/evdev...
Success.
Applied rules from evdev:
rules:      evdev
model:      pc105
layout:     us
options:    compose:menu;caps:none
Trying to build keymap using the following components:
keycodes:   evdev+aliases(qwerty)
types:      complete
compat:     complete
symbols:    pc+us+inet(evdev)
geometry:   pc(pc105)
xkb_keymap {
        xkb_keycodes  { include "evdev+aliases(qwerty)" };
        xkb_types     { include "complete"      };
        xkb_compat    { include "complete"      };
        xkb_symbols   { include "pc+us+inet(evdev)"     };
        xkb_geometry  { include "pc(pc105)"     };
};

As you can see, the difference is that those options are no longer present under “symbols:” or “xkb_symbols”.

I have been trying to figure out any kind of pattern of usage or behavior that would cause this, and nothing comes to mind. This happens on two computers of mine with near identical configurations. Both run certain kinds of server software, so I almost never reboot them, turn them off, or even hibernate/sleep them. I at most turn the monitors off or let their displays go to sleep. I think the switch to things not working most often happens when I’m away from the machine, and I notice once I sit back down, but I’m not entirely sure.

I use Compose all the time. It’s very annoying when it stops working. The reason I bind CapsLock to none is that I never intentionally want to use CapsLock for its intended purpose, and I can actually bind things to the “VoidSymbol” in the wezterm terminal emulator (described here) if Caps is disabled; again it’s annoying when those bindings don’t work.

If I manually run the two commands from my .xinitrc, it fixes things, but again, only temporarily. Eventually, those options stop working again.

I was hoping someone might have some idea about what could be causing this, or at least give me a hint that points me in the right direction to look. Thanks in advance.

Last edited by frabjous (2023-06-13 03:25:13)

Offline

#2 2023-06-13 07:00:25

seth
Member
From: Won't reply 2 private help req
Registered: 2012-09-03
Posts: 76,691

Re: xorg keyboard options/symbols only work temporarily

I didN't read beyond the subject and first 3 lines, but if the device get's re-attached (doesn't have to be physically, could be usb suspend, suspend to ram, …) it gets reset.
Don't call setxkbmap, use https://wiki.archlinux.org/title/Xorg/K … tion_files
If that doesn't fix the problem, reply to overcome my lazyness wink

Offline

#3 2023-06-20 02:41:58

frabjous
Member
Registered: 2010-07-13
Posts: 367

Re: xorg keyboard options/symbols only work temporarily

seth wrote:

I didN't read beyond the subject and first 3 lines, but if the device get's re-attached (doesn't have to be physically, could be usb suspend, suspend to ram, …) it gets reset.
Don't call setxkbmap, use https://wiki.archlinux.org/title/Xorg/K … tion_files
If that doesn't fix the problem, reply to overcome my lazyness wink

Thanks for your reply.

I'm not aware of any devices getting attached or reattached, and it happens without suspending to ram.

I mentioned, I've tried setting them with localectl, which changes the X config files, so that doesn't help.

Offline

#4 2023-06-20 06:04:06

seth
Member
From: Won't reply 2 private help req
Registered: 2012-09-03
Posts: 76,691

Re: xorg keyboard options/symbols only work temporarily

usb autosuspend could re-connect the device.
Please post the localectl generated xorg config you're relying on.
It initially works with *only* that? (w/o you also setting the option via setxkbmap from any script)

And please post the xorg log after the option disappeared hmm

Offline

#5 2023-07-17 13:52:38

frabjous
Member
Registered: 2010-07-13
Posts: 367

Re: xorg keyboard options/symbols only work temporarily

Sorry for taking so long to get back to you. I've been busy and it's hard to know how to track the logs because it happens so inconsistently.

The localectl generated config file is very simple:

$ cat /etc/X11/xorg.conf.d/00-keyboard.conf
# Written by systemd-localed(8), read by systemd-localed and Xorg. It's
# probably wise not to edit this file manually. Use localectl(1) to
# instruct systemd-localed to update it.
Section "InputClass"
        Identifier "system-keyboard"
        MatchIsKeyboard "on"
        Option "XkbOptions" "compose:menu;caps:none"
EndSection

Very little appears in the xorg log between when these settings are applied and when they stop working that seems relevant. The relevant portion for one such occurrence is this:

[115198.940] (II) XINPUT: Adding extended input device "Dell Dell USB Entry Keyboard" (type: KEYBOARD, id 9)
[115198.940] (**) Option "xkb_options" "compose:menu;caps:none"
[115198.943] (II) event2  - Dell Dell USB Entry Keyboard: is tagged by udev as: Keyboard
[115198.943] (II) event2  - Dell Dell USB Entry Keyboard: device is a keyboard
[115198.946] (II) config/udev: Adding input device HDA Intel PCH Front Headphone (/dev/input/event9)
[115198.946] (II) No input driver specified, ignoring this device.
[115198.946] (II) This device may have been added with another device file.
[115198.946] (II) config/udev: Adding input device HDA Intel PCH HDMI/DP,pcm=7 (/dev/input/event11)
[115198.946] (II) No input driver specified, ignoring this device.
[115198.946] (II) This device may have been added with another device file.
[115198.947] (II) config/udev: Adding input device PC Speaker (/dev/input/event5)
[115198.947] (II) No input driver specified, ignoring this device.
[115198.947] (II) This device may have been added with another device file.
[146957.809] (EE) event4  - Logitech USB Optical Mouse: client bug: event processing lagging behind by 23ms, your system is too slow
[147526.825] (EE) event4  - Logitech USB Optical Mouse: client bug: event processing lagging behind by 30ms, your system is too slow
[148124.445] (EE) event4  - Logitech USB Optical Mouse: client bug: event processing lagging behind by 31ms, your system is too slow
[148149.427] (EE) event4  - Logitech USB Optical Mouse: client bug: event processing lagging behind by 29ms, your system is too slow
[148818.834] (EE) event4  - Logitech USB Optical Mouse: client bug: event processing lagging behind by 34ms, your system is too slow
[148818.834] (EE) event4  - Logitech USB Optical Mouse: WARNING: log rate limit exceeded (5 msgs per 60min). Discarding future messages.
[151323.243] (EE) event4  - Logitech USB Optical Mouse: client bug: event processing lagging behind by 29ms, your system is too slow
[152773.239] (EE) event4  - Logitech USB Optical Mouse: client bug: event processing lagging behind by 40ms, your system is too slow
[153071.492] (EE) event4  - Logitech USB Optical Mouse: client bug: event processing lagging behind by 36ms, your system is too slow
[154175.252] (EE) event4  - Logitech USB Optical Mouse: client bug: event processing lagging behind by 43ms, your system is too slow
[154194.786] (EE) event4  - Logitech USB Optical Mouse: client bug: event processing lagging behind by 48ms, your system is too slow
[154194.786] (EE) event4  - Logitech USB Optical Mouse: WARNING: log rate limit exceeded (5 msgs per 60min). Discarding future messages.
[156155.923] (EE) event4  - Logitech USB Optical Mouse: client bug: event processing lagging behind by 28ms, your system is too slow
[157244.735] (EE) event4  - Logitech USB Optical Mouse: client bug: event processing lagging behind by 37ms, your system is too slow

The keys work around the time of the first log entries I've included, which is just after boot. At some point after the later ones they stop working, although since I am not present at the computer when this happens, I don't know if it's at the exact time it starts complaining about my mouse. I do not actually experience any noticeable lag or other problems with my mouse in actual usage, so I'm not sure why it's complaining about my system being too slow. But in any event, I do not understand why this would reset my keyboard options.

Offline

#6 2023-07-17 14:00:26

seth
Member
From: Won't reply 2 private help req
Registered: 2012-09-03
Posts: 76,691

Re: xorg keyboard options/symbols only work temporarily

The semicolon has no business being there, it's supposed to be a comma.

- Option "XkbOptions" "compose:menu;caps:none"
+ Option "XkbOptions" "compose:menu,caps:none"

Offline

#7 2023-07-17 14:04:57

frabjous
Member
Registered: 2010-07-13
Posts: 367

Re: xorg keyboard options/symbols only work temporarily

Thanks. I'll try that and see if it helps, but can you tell me what the right syntax to use is with localectl? The wiki entry doesn't give any examples of using multiple options, and I cannot remember what syntax I used. It's no longer in my bash history.

EDIT: I don't know why I didn't just try it for myself, but I guess I should do something like:

localectl set-x11-keymap '' '' '' 'compose:menu,caps:none'

Just with a comma instead of a semi-colon?

Anyway, I'll report back once it becomes obvious whether or not this helps preserve the options.

Last edited by frabjous (2023-07-17 14:13:20)

Offline

#8 2023-07-17 14:08:50

seth
Member
From: Won't reply 2 private help req
Registered: 2012-09-03
Posts: 76,691

Re: xorg keyboard options/symbols only work temporarily

"vim" - I've never used localectl ever in my entire life. Ever.
According to https://man.archlinux.org/man/localectl.1 it's "set-x11-keymap LAYOUT [MODEL [VARIANT [OPTIONS]]]" and if localectl isn't complete fubar that'd be … there isn't a layout in your config. Sure you used localectl to create that?

Offline

#9 2023-07-17 14:15:04

frabjous
Member
Registered: 2010-07-13
Posts: 367

Re: xorg keyboard options/symbols only work temporarily

If you read the comment at the top it says:

# Written by systemd-localed(8), read by systemd-localed and Xorg. It's
# probably wise not to edit this file manually. Use localectl(1) to
# instruct systemd-localed to update it.

So yes I'm pretty sure I used localectl to generate that. As I mentioned in my edit to my previous post, I'll try it with using a comma in the last option there and see if it makes a difference and let you know.

Last edited by frabjous (2023-07-17 14:15:33)

Offline

#10 2023-07-17 15:48:01

seth
Member
From: Won't reply 2 private help req
Registered: 2012-09-03
Posts: 76,691

Re: xorg keyboard options/symbols only work temporarily

Yes, localectl wrote some file at some point.
Doesn't mean you didn't edit it manually.

Offline

Board footer

Powered by FluxBB