Page 1 of 1

[Donion] [1.1.87] Capslock-ctrl remapping failing in linux

Posted: Thu Jul 20, 2023 4:51 am
by PostmodernPrometheus
Similar to 106031 but I see this in 1.1.87 and maybe not precisely the same.

I remap CapsLock to ctrl in linux using gnome-tweaks version 42.beta
Failure:
When I enable gnome-tweaks setting "Keyboard & Mouse"->"Additional Layout Options"->"Caps Lock behavior"->"Make Caps Lock an additional Ctrl", the CapsLock key is ignored in Factorio (for example "CapsLock+x" acts as "x" alone). Other linux applications understand CapsLock as control with this configuration.

The output of xmodmap in this case
xmodmap: up to 4 keys per modifier, (keycodes in parentheses):

shift Shift_L (0x32), Shift_R (0x3e)
lock Caps_Lock (0x42)
control Control_L (0x25), Caps_Lock (0x42), Control_R (0x69)
mod1 Alt_L (0x40), Alt_R (0x6c), Meta_L (0xcd)
mod2 Num_Lock (0x4d)
mod3
mod4 Super_L (0x85), Super_R (0x86), Super_L (0xce), Hyper_L (0xcf)
mod5 ISO_Level3_Shift (0x5c), Mode_switch (0xcb)
Workaround:
I tried setting "Keyboard & Mouse"->"Additional Layout Options"->"Caps Lock behavior"->"Disabled"
and "Keyboard & Mouse"->"Additional Layout Options"->"Ctrl position"->"Caps Lock as ctrl" and both the Caps Lock and ctrl keys act as control in Factorio

The output of xmodmap in this case
xmodmap: up to 4 keys per modifier, (keycodes in parentheses):

shift Shift_L (0x32), Shift_R (0x3e)
lock
control Control_L (0x25), Control_L (0x42), Control_R (0x69)
mod1 Alt_L (0x40), Alt_R (0x6c), Meta_L (0xcd)
mod2 Num_Lock (0x4d)
mod3
mod4 Super_L (0x85), Super_R (0x86), Super_L (0xce), Hyper_L (0xcf)
mod5 ISO_Level3_Shift (0x5c), Mode_switch (0xcb)
More System info:
OS Name: Pop!_OS 22.04 LTS
GNOME version: 42.9
Windowing System: X11
I use the default GNOME desktop which is "GNOME Shell 42.5"

Re: [Donion] [1.1.87] Capslock-ctrl remapping failing in linux

Posted: Tue Sep 05, 2023 4:13 am
by PostmodernPrometheus
Just to confirm: I do have a workaround that works for me.

I attached xev output for failure and for my workaround.

Re: [Donion] [1.1.87] Capslock-ctrl remapping failing in linux

Posted: Tue Sep 05, 2023 9:32 am
by Donion
Thank you for the report. I can reproduce it on my end and (I think) I understand what is happening.
Proper fix would most likely mean a bigger change in how Factorio handles key events which I don't really want to do right now.
Given that you have a workaround that works for you I'm inclined to leave this as a known minor issue. For now I'm keeping this in assigned, I might think about it more and change my mind.

Re: [Donion] [1.1.87] Capslock-ctrl remapping failing in linux

Posted: Wed Sep 06, 2023 4:14 am
by PostmodernPrometheus
Sounds good, hopefully my workaround has enough info to help anyone else who hits this.

Re: [Donion] [1.1.87] Capslock-ctrl remapping failing in linux

Posted: Thu Sep 07, 2023 3:34 pm
by raiguard
I have had good results using keyd for remapping my capslock to ctrl/escape. It's not built-in to gnome, but it might work for you as well.