Changing the TTY switch shortcut

Just don’t use the function keys in your Ctrl + Alt shortcuts and it shouldn’t be a problem. You could reverse your idea and use Meta + Alt in the IDE instead, which is likely much better, though you may need to avoid meta (depending on what already uses it).


You might be able to do it…at least for X/Wayland…but if you can, then it might break other things. :man_shrugging:

On X you can use xkbcomp $DISPLAY ~/.xkbmap to dump the current config to ~/.xkbmap then edit the file and reapply it using xkbcomp ~/.xkbmap $DISPLAY.

This is some of the relevant config from mine:

type "CTRL+ALT" {
        modifiers= Shift+Control+Alt+LevelThree;
        map[Shift]= Level2;
        preserve[Shift]= Shift;
        map[LevelThree]= Level3;
        map[Shift+LevelThree]= Level4;
        preserve[Shift+LevelThree]= Shift;
        map[Control+Alt]= Level5;
        level_name[Level1]= "Base";
        level_name[Level2]= "Shift";
        level_name[Level3]= "AltGr";
        level_name[Level4]= "Shift AltGr";
        level_name[Level5]= "Ctrl+Alt";
    };

...

key <FK01> {
        type= "CTRL+ALT",
        symbols[Group1]= [              F1,              F1,              F1,              F1, XF86Switch_VT_1 ]
    };

You’d have to create a new type based on the CTRL+ALT type, which replaces level 5 with Meta + Alt, the former may be called Mod1. Of course you also need to apply that type to the definitions for the function keys. Not sure if your chosen modifier keys would work for this.

On wayland you’d have to do the same, but xkbcomp won’t work, you’d have to override the relevant files from /usr/share/X11/xkb, the overrides should be placed in either /etc/xkb or ~/.xkb (or it might be ~/.config/xkb).


Even if you do this, it may still be hard-coded in some places…if so there are no guarantees it would work.

X/wayland use different config to the linux console, not sure if you could change it for the latter…there’s a very good chance it’s hardcoded as @Aragorn said.

It’s better to just choose your shortcuts sensibly.

EDIT:

@Aragorn

Do you have any links to that information?

1 Like