Ubuntu – Alt + F4 switches to TTY4

command linegnomeshortcut-keystty

Since yesterday Alt+F4 is working unexpectedly on my computer. When I press those keys TTY4 is opened. Also, the application which is running on the GUI receives the Alt+F4 message. This is solved by rebooting the system, but after a while it starts doing this again.

As far as I have googled there are other people finding this problem but with no solutions (1, 2).

I am running Ubuntu Gnome 16.10, Kernel version 4.8.0-39-generic and GNOME Shell version 3.20.4.

Best Answer

I had this recently on Ubuntu GNOME and on Unity. The answer is this:

sudo kbd_mode -s

Run that in a terminal and then the Alt+F4 keyboard combination returns to normal.

From kbd_mode man page (from kbd project and package):

kbd_mode - report or set the keyboard mode

Without argument, kbd_mode prints the current keyboard mode (RAW, MEDIUMRAW or XLATE).
With argument, it sets the keyboard mode as indicated:

-s: scancode mode (RAW),