Rebinding/disabling CTRL+ALT+F# Virtual Terminal/Console Switching

The following invocation of the X11 setxkbmap command disables Ctrl-Alt-Fn console/virtual terminal switching:

setxkbmap -option srvrkeys:none

To return to the previous behavior of the ctrl-alt-Fn keys, and also remove all other options, such as caps:ctrl_modifier:

setxkbmap -option ''

To print the current settings invoke setxkbmap -print.

To invoke per user, put the command in the ~/.xinitrc file.

To invoke when an Xsession starts, create a file in

/etc/X11/Xsession.d

such as

/etc/X11/Xsession.d/65srvrkeys-none

containing the above setxkbmap command, and make it executable with sudo chmod +x /etc/X11/Xsession.d/65srvrkeys-none.

For more information type man setxkbmap at your shell prompt or see the Xorg setxkbmap man page.

I tested this with KDE on Ubuntu 14.04 LTS (Trusty). These settings are also available in System Settings > Input Devices > Keyboard > Advanced. If you change srvrkeys in the GUI Settings, it shows up immediately in setxkbmap and vice versa.

I prefer to modify the X window system via the X11 command line interfaces. If that does not work, then I attempt the desktop environment. As a last resort I would modify system configuration files. Implementations and file formats change, but command line interfaces live almost forever in the Unix/Linux tradition.


Place this in your /etc/X11/xorg.conf file to disable VT switching with Ctrl+Alt+Fn:

Section "ServerFlags"
    Option "DontVTSwitch" "on"
EndSection

You will also need the following to cause events to be passed through to clients connected to the display:

Section "InputClass"
    Identifier "keyboard defaults"
    MatchIsKeyboard "on"
    Option "XKbOptions" "srvrkeys:none"
EndSection

(That last bit is untested, refer to its source.)


You can disable this by going to System settings -> keyboard layout -> option. under miscellaneous compatibility options check "special keys Ctrl+Alt+<key> handled in server".

I checked this and Ubuntu does not catch any combination of Ctrl+Alt+... . but still idea does not catch Ctrl+Alt+F7 and the problem still exits!!!.