Have broken keys on your keyboard, or want to remap a key for other use in Ubuntu? Here’s how to do the trick step by step in Ubuntu 22.04 LTS.
Method 1: Remap Ctrl, Alt, Caps Lock etc via Gnome Tweaks
For some commonly used keys (e.g., Ctrl, Alt, Caps Lock), the popular Gnome Tweaks configuration tool has the ability to remap the keys via few clicks.
With it, you may remap:
- Alt to Windows (or Right Windows) key
- swap Left Alt with Left Windows.
- Ctrl to Alt
- Ctrl to Windows (or Right Windows) key.
- swap Esc and Caps Lock.
- Windows to PrintScreen.
- swap Ctrl with Caps Lock.
- And more ….
Firstly, search for and install Gnome Tweaks from Ubuntu Software if you don’t have it:
Next, search for and open Gnome Tweaks from the 9 grids ‘Show Applications’ screen.
Finally, go to Keyboard & Mouse settings from left pane and click on ‘Additional Layout Settings’ in the right.
After that, you’ll see the pop-up dialog for remapping these keyboard keys!!
Method 2: Remap Any Key via Input-Remapper tool:
Ubuntu 22.04 has an input-remapper package in its system repository. You may use the tool to remap any keyboard, mouse, or gamepad keys.
1. Firstly, press Ctrl+Alt+T on keyboard to open terminal and run command to install the tool:
sudo apt update && sudo apt install input-remapper
2. If the previous command run successfully, you may now search for and open the tool from overview screent:
3. When the app opens, choose your keyboard from the device list. Then, create or just use the current ‘Preset’.
To map a key, click ‘new entry‘ -> ‘Change Key‘ and then press a key on keyboard. It will create a new entry with the key you just pressed as its name. Select it and input the key you want to remap it to.
After all, click on ‘Apply‘ will make the changes work immediately. Or, Turn on ‘Autoload‘ make the remaps work automatically on login.
UPDATE: Input-remapper package in Ubuntu repository is always old. For the latest version, download & install the .deb
package from GitHub release page.
However, it’s recommended to remove the old stock version by running sudo apt remove --autoremove input-remapper-daemon
command in terminal before installing the new .deb package.
And the UI has changed a lot, see the v2.0 screenshots & see HERE for output key examples.
That’s all. Enjoy!