my setup is the following:

I have a notebook (with integrated keyboard/non-Apple running Arch) and an external keyboard (fancy Apple keyboard)

The problem is that Apple uses a different internal layout for its keyboards. For example the alt and the cmd/windows keys are switched.

For now I have a script that changes the keymap globally in X11/setxkbmap (for all keyboards) so that alt and the windows key are in the correct place, but then they are wrong on the internal one.

Is there a way for Linux to detect an external keyboard (by id or something), assign a specific keymap in console and X11, while leaving the internal keyboard untouched?


When looking for hardware issues the Arch Wiki is a great resource.

Apple Keyboards Arch Wiki

"You can use the AUR package un-apple-keyboardAUR. Currently it only works for the aluminium USB model." Not sure if this is your model.

This switches the cmd and meta keys $ echo 1 | sudo tee /sys/module/hid_apple/parameters/swap_opt_cmd

Run the following command to append the configuration line to the file and make the change permanent.

/etc/modprobe.d/hid_apple.conf creating it if necessary:
$ echo options hid_apple swap_opt_cmd=1 | sudo tee -a /etc/modprobe.d/hid_apple.conf
| improve this answer | |

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.