You are not logged in.

#1 2015-04-25 01:11:48

Pavlov
Member
Registered: 2015-04-24
Posts: 6

[Solved] Change Xorg tty keybinds

Ok, I've been trying to figure this out on my own, but a few hours fiddling with xmodmap and XKB hasn't gotten me anywhere, so I'll ask: in an X session, the default keybinds to switch to a tty are Ctrl+Alt+F#. How would I go about changing this keybind to something else, say, Alt+F#, like it is when I'm already focused on a tty?

Last edited by Pavlov (2015-05-22 03:44:03)

Offline

#2 2015-04-25 01:15:33

karol
Archivist
Registered: 2009-05-06
Posts: 25,440

Re: [Solved] Change Xorg tty keybinds

Offline

#3 2015-04-25 01:48:02

Pavlov
Member
Registered: 2015-04-24
Posts: 6

Re: [Solved] Change Xorg tty keybinds

I looked at that, but it seemed like kind of a hack-y workaround. Also chvt needs elevated privileges when inside of an X session to grab the file descriptor for the console, so it's not quite suitable unless I want to introduce some needless security holes.

I figured out from my keymap table that the functionality for changing to a tty is bound to the XF86Switch_VT_# keysymbols. I'm just not sure how to force something like Alt+F2 to produce the keysymbol XF86Switch_VT_2. None of the keysym columns in the keymap seem to work for that. I've only managed to get plain 'F2' and Shift+F2 to resolve correctly to it.

Edit: Oh, if you meant the third answer to that, then it unfortunately doesn't work for Alt+F# specifically. The Alt+F# rules are already in the console mappings, but it seems like Xorg intercepts them somehow. I would need a way to stop that interception.

Last edited by Pavlov (2015-04-25 02:01:56)

Offline

#4 2015-05-22 03:43:38

Pavlov
Member
Registered: 2015-04-24
Posts: 6

Re: [Solved] Change Xorg tty keybinds

Ok, I have managed to divine the answer after much head-bashing. The configuration for the X11 virtual terminal switching is in /usr/share/X11/xkb/symbols/srvr_ctrl. There are as series of blocks like this for each VT:

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

To have it to use ALT+F1 instead of CTRL+ALT+F1, change it to:

    key <FK01> {
        type="PC_ALT_LEVEL2",
        symbols[Group1]= [ F1, XF86_Switch_VT_1 ]
    };

For any other varient, look at the files in /usr/share/X11/xkb/types and find a type that corresponds to what you want, or add one of your own.

Offline

#5 2015-10-16 21:04:27

fluxboxer
Member
Registered: 2012-12-02
Posts: 118

Re: [Solved] Change Xorg tty keybinds

My solution (to change from X to tty2 with Eject instead of Ctrl+Alt+F2) was to

1. Find the keycode and keysym of Eject by xev which are 169 and XF86Eject with my keyboard

2. Replace the line

key <I169>   {      [ XF86Eject             ]       };

with

key <I169>   {      [ XF86_Switch_VT_2             ]       };

in /usr/share/X11/xkb/symbols/inet

Offline

Board footer

Powered by FluxBB