Skip to content

Instantly share code, notes, and snippets.

@widiu7omo
Forked from dchenk/swap-ctrl-alt-gnome.md
Created February 17, 2021 07:24
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save widiu7omo/e2d4c08d0359dbc5a2e0167bd708f335 to your computer and use it in GitHub Desktop.
Save widiu7omo/e2d4c08d0359dbc5a2e0167bd708f335 to your computer and use it in GitHub Desktop.
Swap CTRL and ALT keys on GNOME

Swap CTRL and ALT keys on GNOME

From here: https://askubuntu.com/a/101877

Create a file called .Xmodmap in your home directory.

$ vim ~/.Xmodmap

Add the following lines to the file:

clear control
clear mod1
keycode 37 = Alt_L Meta_L
keycode 64 = Control_L
add control = Control_L Control_R
add mod1 = Alt_L Meta_L

Save the file. Next time you login the new key mappings will be active. To have the settings take immediate effect run the command:

$ xmodmap ~/.Xmodmap

There's a chance that the keycodes above are different on your computer. If the above doesn't work, try running the xev program from the command line. Xev will generate a new small window in the corner of your screen. If you start pressing keys on your keyboard you’ll get all the key mapping information for that key press.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment