I have an application that binds CTRL+ALT+F7, but my linux machine seems to catch the keystroke.
Is there a way to rebind/disable this key? A recompile of the kernel is an acceptable answer.
The distributions in question are Fedora 16 and Ubuntu 11.10.
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
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.
Method 2
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.)
Method 3
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!!!.
Method 4
In Ubuntu 18.04 you need to create the following file:
/usr/share/X11/xorg.conf.d/65-setxkbmap
with this content:
Section "ServerFlags"
Option "DontVTSwitch" "on"
EndSection
Section "InputClass"
Identifier "keyboard defaults"
MatchIsKeyboard "on"
Option "XKbOptions" "srvrkeys:none"
EndSection
then reboot your system.
Method 5
Solution for Gnome Wayland: You can unset the keybindings for virtual terminal switching by setting these dconf properties:
dconf write /org/gnome/mutter/wayland/keybindings/switch-to-session-1 "['']" dconf write /org/gnome/mutter/wayland/keybindings/switch-to-session-2 "['']" dconf write /org/gnome/mutter/wayland/keybindings/switch-to-session-3 "['']" dconf write /org/gnome/mutter/wayland/keybindings/switch-to-session-4 "['']" dconf write /org/gnome/mutter/wayland/keybindings/switch-to-session-5 "['']" dconf write /org/gnome/mutter/wayland/keybindings/switch-to-session-6 "['']" dconf write /org/gnome/mutter/wayland/keybindings/switch-to-session-7 "['']" dconf write /org/gnome/mutter/wayland/keybindings/switch-to-session-8 "['']" dconf write /org/gnome/mutter/wayland/keybindings/switch-to-session-9 "['']" dconf write /org/gnome/mutter/wayland/keybindings/switch-to-session-10 "['']" dconf write /org/gnome/mutter/wayland/keybindings/switch-to-session-11 "['']" dconf write /org/gnome/mutter/wayland/keybindings/switch-to-session-12 "['']"
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