-
-
Save rbreaves/f4cf8a991eaeea893999964f5e83eebb to your computer and use it in GitHub Desktop.
# 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! | |
# |
I’m not sure how it gets any clearer. If you’re not dealing w/ an apple keyboard where you can fix it via the hid driver then this. (Although it’d also work on the apple keyboard too. Just don’t apply the apple_hid specific driver key swap unless you’d prefer that method.. it’s documented up above too.)
# 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
Everything in my gist is well commented & a little bit of copying & pasting into your terminal would quickly reveal what’s going on (if my comments weren’t clear enough already) - but yes, make sure you know how to reset things before randomly applying things. Aka this resets setxkbmap. setxkbmap -option
.
Pretty sure googling how to reset it though would have taken all of 5 seconds. The harder part of getting all of this info in one spot has already been done.
This gist was an early document & outline for what needed to happen for Kinto to be created to fully mimic Mac style keys. It is not intended to be a full solution for anything or anyone. Anyone can use it & look at it of course & it may be helpful to some.
@rbreaves Can you please show me how can I just swap these two keys.... I mean I was able to find these files online but no instructions on how to set them up.
I would say that my biggest fear is to change something that would break my system after.