Software & AppsOperating SystemLinux

How To Fix Alt + F4 Switching to TTY4 in Ubuntu Gnome

Ubuntu 15

In the world of Ubuntu Gnome, you may sometimes encounter an issue where pressing Alt + F4 switches to TTY4 instead of closing the active application window. This can be quite frustrating, especially if you’re used to using this shortcut to quickly close applications. In this article, we will discuss how to fix this issue and restore the normal behavior of Alt + F4.

Quick Answer

To fix the issue of Alt + F4 switching to TTY4 in Ubuntu Gnome, you can use a temporary solution by running the command "sudo kbd_mode -s" in the terminal. This restores the normal behavior of Alt + F4, but needs to be repeated after each boot. For a more permanent solution, you can edit the file "/etc/console-setup/remap.inc" and add the line "alt keycode 62 = VoidSymbol". After running "sudo dpkg-reconfigure console-setup -phigh" and rebooting your system, Alt + F4 should close the active application window as expected.

Understanding the Issue

Before we jump into the solution, let’s understand the issue. The problem arises when Alt + F4 opens TTY4 instead of performing its usual function of closing the active window. This issue seems to be related to a kernel upgrade and has been reported on other Linux distributions as well.

Temporary Solution

A temporary solution to this problem involves running a specific command in the terminal. Open your terminal and type the following command:

sudo kbd_mode -s

The kbd_mode command is used to report or set the keyboard mode. The -s option sets the keyboard mode to “scancode” or “raw” mode. This restores the normal behavior of Alt + F4.

However, this solution is temporary and needs to be repeated after each boot. If you want to switch back to “Unicode (UTF-8) mode”, you can use the following command:

sudo kbd_mode -u

The -u option sets the keyboard mode to “Unicode (UTF-8)”.

Permanent Solution

For a more permanent solution, you can edit a specific file and add a line of code. Here are the steps:

  1. Open the terminal and type the following command to open the file as root:
sudo nano /etc/console-setup/remap.inc

The nano command opens the nano text editor. The sudo command is used to perform tasks that require administrative or root permissions.

  1. Add the following line at the bottom of the file:
alt keycode 62 = VoidSymbol

The alt and keycode 62 refer to the Alt + F4 key combination. The VoidSymbol effectively disables the action associated with this key combination.

  1. Save and close the file. In nano, you can do this by pressing Ctrl + X, then Y to confirm saving the changes, and finally Enter to confirm the file name.
  2. Now, run the following command:
sudo dpkg-reconfigure console-setup -phigh

The dpkg-reconfigure command reconfigures packages after they have already been installed. The -phigh option specifies the priority of questions that should be asked.

  1. Finally, reboot your system. You can do this by typing the following command in the terminal:
sudo reboot

After rebooting, the Alt + F4 key combination should now close the active application window as expected.

Conclusion

In this article, we discussed how to fix the issue of Alt + F4 switching to TTY4 in Ubuntu Gnome. We provided both a temporary and a permanent solution to this problem. While the temporary solution involves changing the keyboard mode, the permanent solution involves editing a file and adding a line of code. We hope this article has been helpful in resolving this issue. If you have any questions or need further assistance, feel free to ask in the comments section below.

Why does pressing Alt + F4 switch to TTY4 instead of closing the active window in Ubuntu Gnome?

This issue is related to a kernel upgrade and has been reported on other Linux distributions as well. It can be fixed by following the solutions mentioned in the article.

What is TTY4?

TTY4 refers to a virtual terminal in Linux. It is a text-based interface that allows you to interact with the system directly, without a graphical user interface.

Why is the temporary solution only temporary?

The temporary solution involves changing the keyboard mode using the kbd_mode command. This setting is not persistent and needs to be reapplied after each boot.

What does the permanent solution involve?

The permanent solution involves editing a configuration file and adding a line of code to disable the action associated with the Alt + F4 key combination. This ensures that the desired behavior is maintained even after system reboots.

Can I revert back to the original keyboard mode after applying the permanent solution?

Yes, you can switch back to the original keyboard mode by removing the line of code added to the configuration file, or by using the sudo kbd_mode -u command to set the keyboard mode to "Unicode (UTF-8)".

Will applying the permanent solution cause any other issues?

No, applying the permanent solution should not cause any other issues. It simply modifies the behavior of the Alt + F4 key combination to close the active window, as intended.

Is it necessary to reboot the system after applying the permanent solution?

Yes, rebooting the system is necessary for the changes to take effect. It ensures that the new configuration is applied and the Alt + F4 key combination behaves as expected.

Leave a Comment

Your email address will not be published. Required fields are marked *