Remap Macbook Pro Command Key as Control on AlmaLinux 9 or any X11 Linux GUI

Remap Command Key to Control in AlmaLinux 9

If you’re using AlmaLinux 9 and want to remap the Command (⌘) key to work as the Control (Ctrl) key for a more comfortable experience, especially for Mac users transitioning to Linux, this guide will help you easily make this change.

Why Remap Command to Control?

Mac users are accustomed to using the Command key for keyboard shortcuts, while Linux users rely on the Control key. Remapping the Command key to function as Control can boost productivity and improve workflow, particularly if you’re using a Mac keyboard.

Steps to Remap Command to Control in AlmaLinux 9

Identify Key Codes: First, open a terminal and use the xev command to find the key codes for Command and Control. Execute:

xev

A small window will open. Press the left Command key and the left Control key to record the key codes. For most systems:

  • Command (⌘) key = key code 64
  • Control (Ctrl) key = key code 37

Remap the Keys: You can use xmodmap to remap the keys. In your terminal, enter the following commands:

xmodmap -e "keycode 64 = Control_L"
xmodmap -e "keycode 37 = Super_L"

This replaces the left Command key with the left Control key.

Make the Change Permanent: To ensure this change persists after a reboot, create or edit your .Xmodmap file:

nano ~/.Xmodmap

Add the following lines:

keycode 64 = Control_L
keycode 37 = Super_L

Save the file and ensure it loads at startup by adding this to your .xinitrc or .xprofile:

xmodmap ~/.Xmodmap

Conclusion

By following these simple steps, you can remap the Command key to function as Control in AlmaLinux 9, making your transition from macOS to Linux smoother and improving your overall quality of life (QOL) when working with keyboard shortcuts.

 

 

 

Leave a Reply

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