8

I have caps-lock key remapped to control, which usually works fine, but after some uptime and one/more suspend/awake cycles* this mapping breaks, and caps-lock reverts back to the default behavior -- i.e. turning on the led and capitalizing whatever I type. (Even though the Tweaks UI still shows it as being mapped to Ctrl -- see picture below.)

Tweaks UI

Questions:

  • Is this a known issue (with maybe a known fix)? (Could not find anything relevant with a quick search.)
  • Is there a way to debug the problem, preferably from the command line?

*Remark: I'm not sure it is the suspend/awake cycle that causes the problem, but I can't connect it to anything else...

Remark2: removing and readding the mapping (or rebooting) solves the problem, but it would be nice to find a more permanent solution.

Attilio
  • 231
  • 1
  • 4
  • Update: this happens also with the mouse buttons (I made the right button the primary one, but it keeps randomly going back to the left...) – Attilio Nov 10 '20 at 18:33
  • Related: https://askubuntu.com/questions/1291175/casp-to-escape-mapping-gets-reverted-behind-the-scenes – k0pernikus Nov 12 '20 at 11:37

3 Answers3

7

As a workaround when the mapping breaks, restart gnome shell via:

  • Alt+F2
  • type r
  • hit enter

so it works again until it breaks again.

k0pernikus
  • 5,995
  • 11
  • 48
  • 78
santeyio
  • 71
  • 3
  • 1
    Can confirm that the workaround is easier than toggling the settings. It also is helpful that your windows will persist after the restart of the gnome shell session so you don't lose any work. – k0pernikus Nov 12 '20 at 11:01
  • This fixed an issue for me where the remapping was working on the built-in laptop keyboard but _not_ on the USB keyboard I plugged in. Thank you! – Vincent Tjeng Nov 22 '20 at 01:12
4

It's bug #1899206. There is this PPA with the assumed fix, and if you want to fix it for yourself before the bug gets fixed in 20.04 officially, you can install the mutter packages from the PPA and reboot.

Gunnar Hjalmarsson
  • 32,938
  • 3
  • 63
  • 94
  • 1
    The PPA fix works fine for me! – k0pernikus Nov 12 '20 at 11:59
  • I upgraded to 20.10 and there the PPA isn't working for me. Would it be possible for you to provide the fix also for groovy? – k0pernikus Jan 06 '21 at 13:58
  • 1
    @k0pernikus: There is an upload in `groovy-proposed` which includes the fix, so I would suggest that you update your mutter packages from there instead. – Gunnar Hjalmarsson Jan 06 '21 at 19:57
  • Thank you for the pointer! You may add the ppa bit to your answer in case somebody on 20.10 stumboles on this :) – k0pernikus Jan 08 '21 at 12:45
  • 1
    @k0pernikus: Well, it ought to make it to `groovy-updates` any day now. But please feel free to edit the answer if you think it's motivated. – Gunnar Hjalmarsson Jan 08 '21 at 12:48
  • While I'm presently running Ubuntu 20.04, complete w/the Mutter Pkg add, I also ran into this problem, like centuries ago. I submit that the script that was just included in the next comment will be functional, with[out] Mutter, on 20.[1-9]0, 20.04, 18.x, 16.x, etc. While it doesn't fix the problem within the OS, at the source, it's hyperfunctional at user level, via [ba,k,etc]sh, and might even fix your headache ;^). – odoncaoa Jul 03 '21 at 22:35
1

As I kept encountering the same behavior, I too had gone to seek manual manners which this issue could be corrected. I found solutions, one of which I incorporated into a script which can 1) be invoked upon login via .profile; and 2) Invoked from the tty; which will do the work, and correct the problem at any time:

 /home/odoncaoa 2021-07-03 17:59
 odoncaoa@tufFX705du[2]$ cat .uxSwapCapsLock-and-Ctrl
 #!/bin/bash
 xmodmap -e "remove Lock = Caps_Lock"
 xmodmap -e "remove Control = Control_L"
 xmodmap -e "keysym Control_L = Caps_Lock"
 xmodmap -e "keysym Caps_Lock = Control_L"
 xmodmap -e "add Lock = Caps_Lock"
 xmodmap -e "add Control = Control_L"
 #End script

Oh yeah, and in order to have this work to do the remappings via the cmdLn use: '. $HOME/.uxSwapCapsLock-and-Ctrl', for instance.

odoncaoa
  • 77
  • 1
  • 7