The keyboard layout in Ubuntu is based on Windows (the standard keyboard). On the Mac, there are two extra keys which Ubuntu does not recognize, the two Command keys. It’s configured with Super (Windows) keys instead.
It’s a waste of space to have two Super keys. This post shows you how to configure these keys to perform the functions they intend to (such as copy, paste, and close window, etc), also known as remapping.
- Open the terminal.
- Type the following commands and press enter to create a file called .xmodmap in the root of your home folder.
cat <<EOF > .xmodmap remove control = Control_L Control_R remove mod4 = Super_L Super_R keysym Control_L = Super_L keysym Super_L = Control_L Control_L keysym Super_R = Control_R Control_R add mod4 = Super_L Super_R add control = Control_L Control_R EOF xmodmap .xmodmap
- You are free to edit the file using either gEdit or nano to suit your needs. You can test your keyboard and get the keycode or keysym for the keys you want to be mapped with the command “xev”. To end this command, just switch to another window or click the desktop and refocus the terminal window and press Ctrl + Z (Note: Not the command key).
- After you are satisfied with the result, it’s time to rename .xmodmap so it will automatically remap the keyboard whenever Ubuntu is started.
- Type the following command to the terminal to rename the file .xmodmap to .Xmodmap.
- Restart the system.
Enjoy Ubuntu with your remapped keyboard!
Note: Almost all the keyboard shortcuts work fine under the remapped keyboard except one. The keyboard shortcut for switching between windows in OS X is Command + Tab. However, since Windows uses Alt + Tab for this shortcut and the above steps mapped Command keys with Ctrl keys. Therefore, you have to change the habit of using Command + Tab to Alt + Tab for switching windows.
Do you have any other solutions or have problem to configure the keyboard under Ubuntu after following the above steps? Please leave a discussion below.