Last active
December 20, 2018 14:01
-
-
Save ryankhart/456a70cb53f918eafb7cd99492d8dbcf to your computer and use it in GitHub Desktop.
Swap both left and right Control and Alt keys on Linux
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
# Create or append to .Xmodmap the new | |
# mappings for Control and Alt | |
echo ' | |
clear control | |
clear mod1 | |
keycode 105 = Alt_R | |
keycode 108 = Control_R | |
keycode 37 = Alt_L Meta_L | |
keycode 64 = Control_L | |
add Control = Control_L Control_R | |
add Mod1 = Alt_L Meta_L' >> ~/.Xmodmap | |
# Activate the changes now | |
xmodmap ~/.Xmodmap | |
# Set it to keep the changes at startup | |
echo ' | |
# On startup, swap Alt and Control | |
if [ -f $HOME/.Xmodmap ]; then | |
/usr/bin/xmodmap $HOME/.Xmodmap | |
fi' >> ~/.profile |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment