3

I can disable Caps Lock in the GUI using following command:

setxkbmap -option ctrl:nocaps 

But how can I disable it completely in the console, on a machine without X/GUI ?

1

2 Answers 2

3
dumpkeys | sed s/Caps_Lock/Control/ | loadkeys 

On Debian and alike, just putting XKBOPTIONS="ctrl:nocaps" in /etc/default/keyboard works for both the console and X11 -- provided that you have the console-setup package installed. Use the setupcon command to immediately re-load that file.

4
  • adding XKBOPTIONS="ctrl:nocaps" to /etc/default/keyboard has no effect. And I don't have dumpkeys command and cannot find package to install it on Debian. Commented Jan 22, 2021 at 11:30
  • dumpkeys is part of the kbd package. I cannot test it right now, but I think that setupcon reloads /etc/default/keyboard. If it doesn't, then just reboot ;-) Commented Jan 22, 2021 at 11:34
  • installed kbd, but still don't have setupcon command. I have rebooted, but that did not help. Commented Jan 22, 2021 at 11:38
  • 1
    setupcon is part of console-setup, not of kbd. As I said, it's dumpkeys which is part of kbd. But they're both installed by default on Debian, and dumpkeys + loadkeys are present in any PC Linux distro I know of. If you stripped-down & "optimized" your system, you're in for a ride ;-) I wish you good-luck! Commented Jan 22, 2021 at 13:40
0

Have been struggling to find information on line about this. I went with creating a "custom keymap", as suggested by the Arch Wiki. My commands were something like:

zcat /usr/share/kbd/keymaps/i386/qwerty/uk.map.gz > ~/personal.map vim ~/personal.map sudo cp ~/personal.map /usr/share/kbd/keymaps/ 

I used i386/qwerty/uk.map as a base because it was what I mostly wanted. It includes other maps meaning the file is much smaller than you'd get from dumpkeys. I only wanted to override a couple of modifier keys so this worked well for me.

You can verify it's getting recognized by running:

localectl list-keymaps | grep personal 

and then set it as default by running:

sudo localectl set-keymap personal 

You must log in to answer this question.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.