Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
Universal macOS keyboard layout for Linux - Applies to All Windows and Apple Keyboards
# permanent apple keyboard keyswap
echo "options hid_apple swap_opt_cmd=1" | sudo tee -a /etc/modprobe.d/hid_apple.conf
update-initramfs -u -k all
# Temporary & instant apple keyboard keyswap
echo '1' | sudo tee -a /sys/module/hid_apple/parameters/swap_opt_cmd
# Windows and Mac keyboards - GUI (Physical Alt is Ctrl, Physical Super is Alt, Physical Ctrl is Super)
setxkbmap -option;setxkbmap -option altwin:ctrl_alt_win
# Windows and Mac keyboards - Terminal Apps (Physical Alt is Super, Physical Super is Alt, Physical Ctrl is Ctrl)
setxkbmap -option;setxkbmap -option altwin:swap_alt_win
# If the hid_apple driver is not loaded for Apple keyboards, which can be found out
# by the lsmod command then the above setxkbmap commands will not work
# Use the following commands for Apple style keyboards without an hid_apple driver
#
# Note: this could also apply to hid_apple driver as well
# if this option is set to 0 inside swap_opt_cmd
#
lsmod | grep hid_apple
# Apple keyboard without hid_apple - GUI
setxkbmap -option;setxkbmap -option ctrl:swap_lwin_lctl,ctrl:swap_rwin_rctl
# Apple keyboard without hid_apple - Terminal
setxkbmap -option;setxkbmap -option altwin:alt_super_win
#
# If you want a systemd service and bash script to help toggle between
# GUI and Terminal applications then look at project Kinto.
# https://github.com/rbreaves/kinto
#
# Note: The above may not work for Chromebooks running Linux, please look
# at project Kinto for that.
#
# If anyone would like to contribute to the project then please do!
#
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.