How to disable Alt-Arrow switching of Virtual Consoles?

The following happens on different Linuces:

When I’m in a virtual console, hold Alt and press or , the virtual ttys cycle. This is really annoying as I’m using fish-shell which also uses this key combo. I could remap fish’s short cuts, but I don’t want to. Instead I want to disable the linux function or remap it.

How can I disable or change the tty-cycling-key-combo?

Answers:

Thank you for visiting the Q&A section on Magenaut. Please note that all the answers may not help you solve the issue immediately. So please treat them as advisements. If you found the post helpful (or not), leave a comment & I’ll get back to you as soon as possible.

Method 1

Here’s a one-off fix:

sudo sh -c 'dumpkeys |grep -v cr_Console |loadkeys'

Method 2

I refactored Tobu’s answer to change only the absolutely necessary:

sudo sh -c 'dumpkeys -k|grep -v Incr_Console|grep -v Decr_Console|grep -v Last_Console|loadkeys'

NB: As said this is a one-off fix, and will probably be gone after a reboot.

Method 3

I had the problem sometimes with Ubuntu 18.04:

sudo kbd_mode -s

Did the job. (at least temporarily)

You can find a long bug report here on launchpad .

Method 4

You can use the loadkeys command to remap keys on the Linux console. The following lines define the key bindings to switch consoles (on a PC keyboard):

alt keycode 105 = Decr_Console
alt keycode 106 = Incr_Console

Load your own keymap file that overrides these bindings with an escape sequence that fish recognizes. To make a key send an escape sequence, you need to bind it to a key name of the form FNUMBER and define a character sequence for FNUMBER.

alt keycode 105 = F105
alt keycode 106 = F106
string F105 = "3333[D"
string F105 = "3333[C"

Different distributions (and sometimes different packages for console support) store the system boot-time keymap in different locations under /etc. Look for a file called *.kmap or *.kmap.gz or *.map or *.map.gz under /etc or consult your distribution’s manual. Some distributions store a the keymap’s name in /etc instead and put the actual keymap elsewhere; look for a keymap-related setting under /etc/sysconfig or other configuration directory.

You can either write your own keymap and use include "/path/to/foo.map" to reference the system keymap, or arrange to load your own keymap containing just the settings you want to change during the boot process.

Method 5

On my modern systemd system, I ran localectl set-keymap us and localectl set-x11-keymap us, which resolved this issue for me.

In general, the simplest way of setting keymaps on systemd systems is probably localectl. See the Arch Wiki for further details.


All methods was sourced from stackoverflow.com or stackexchange.com, is licensed under cc by-sa 2.5, cc by-sa 3.0 and cc by-sa 4.0

0 0 votes
Article Rating
Subscribe
Notify of
guest

0 Comments
Oldest
Newest Most Voted
Inline Feedbacks
View all comments
0
Would love your thoughts, please comment.x
()
x