You are not logged in.

#1 2021-01-05 20:34:41

Adcock
Member
From: Earth
Registered: 2020-06-14
Posts: 8

[SOLVED] tty switching using Alt + left/right arrow keys do not work

Heya,
I am Adcock.
I am having problem switching ttys using 'Alt + left/right arrow keys' when in Xorg.
I know I can use 'Ctrl+Alt+F*' but 'Alt + left/right arrow keys' would be much easier.
I can switch using 'Alt + left/right arrow keys' when in (Linux console) tty but in Xorg I can't do that.
I am using I3 WM and I do use Alt as a modifier key.
I changed the config (I3's) so that it doesn't use Alt as modifier key but, I could not switch tty using the said key combinations.
I need to either change and reconfigure linux console to use some other key for changing tty.
Or I need xorg (maybe I3) to let me use 'Alt + left/right arrow keys' to change ttys.

So how can I customize those keys?

Thanks for reading.

Here is my i3 config which I tested. (after commenting  out Alt)

Last edited by Adcock (2021-02-06 15:11:51)

Offline

#2 2021-01-05 21:44:42

Skunky
Member
Registered: 2018-01-25
Posts: 231

Re: [SOLVED] tty switching using Alt + left/right arrow keys do not work

This is exactly how tty switch should work, you can't use Alt to change tty while you are in X, maybe you can configure your keybindings to your liking, see "man chvt"

Offline

#3 2021-01-06 10:08:48

Adcock
Member
From: Earth
Registered: 2020-06-14
Posts: 8

Re: [SOLVED] tty switching using Alt + left/right arrow keys do not work

Thanks for replying.
Okay.
But is it possible to change the key bindings for the tty (Linux Console)?
I have a solution for Xorg but I don't want to change Xorg key bindings as some of the gui programs also use 'Alt + left/right arrow keys', for example firefox, palemoon, weechat, I3 (It uses Ctrl+Alt+left/right arrow keys)....etc.

Offline

#4 2021-01-14 20:33:55

Adcock
Member
From: Earth
Registered: 2020-06-14
Posts: 8

Re: [SOLVED] tty switching using Alt + left/right arrow keys do not work

I have found a solution for changing the keys for linux console.
Orginal Answer

Temporary:
For this, one would have to create a keymap file
For me the file is :

alt Shift keycode 36 = Decr_Console
alt Shift keycode 39 = Incr_Console

alt keycode 105 = nul
alt keycode 106 = nul

This works temporarily for current session [affects all virtual consoles and will therefore outlive your session]
Last two lines just modifies alt+left/right keys so that these can't be used for changing tty.
First two lines enables user to use alt+shift+h/s (for dvorak layout) to change tty
With this same keymap a qwerty user would use alt+shift+j/; for changing tty

Then save this file to 'file_name', then run as root inside linux console :

cat file_name | loadkeys

Permanent:
To make this persistent created a keymap file 'keymap-file-name.map' using 'include' as follows :

include "dvorak.map"

alt Shift keycode 36 = Decr_Console
alt Shift keycode 39 = Incr_Console

alt keycode 105 = nul
alt keycode 106 = nul

Here I included dvorak.map but one should use whatever keymap they want to use.
This is done so that one doesn't have to create a totally new layout.

Compress keymap-file-name.map using gzip.

Then copy it to appropriate directory under:

/usr/share/kbd/keymaps/*

One may need root permission for this.
I copied it to:

/usr/share/kbd/keymaps/i386/dvorak/

Then as root run :

localectl set-keymap --no-convert keymap-file-name

To learn more see :

man loadkeys
man dumpkeys
man keymaps

If anyone knows about any other directory where,
'localectl' can detect keymaps and where root permission is not required,
please do tell.

Last edited by Adcock (2021-01-14 20:43:38)

Offline

Board footer

Powered by FluxBB