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.

2

3 Answers 3

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.

2
  • 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, 2020 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! Nov 22, 2020 at 1: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.

6
  • 1
    The PPA fix works fine for me!
    – k0pernikus
    Nov 12, 2020 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 6, 2021 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. Jan 6, 2021 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 8, 2021 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. Jan 8, 2021 at 12:48
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.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .