Apple Keyboard

From ArchWiki
Jump to: navigation, search

Related articles

Some Apple keyboard models may have swapped keys or missing functionality. This article describes how to change the settings for the keyboard so that it behaves as expected.

Numlock is on

You may find that the numlock is on. The symptoms are that only the physical keys 7,8,9,u,i,o,j,k,l and surrounding keys work and output numbers. To fix this hit Fn+F6 twice.

Alternatively, set the keycodes manually using xmodmap to avoid use Numlock:

keycode  90 = KP_0 KP_0 KP_0 KP_0 KP_0 KP_0
keycode  87 = KP_1 KP_1 KP_1 KP_1 KP_1 KP_1
keycode  88 = KP_2 KP_2 KP_2 KP_2 KP_2 KP_2
keycode  89 = KP_3 KP_3 KP_3 KP_3 KP_3 KP_3
keycode  83 = KP_4 KP_4 KP_4 KP_4 KP_4 KP_4
keycode  84 = KP_5 KP_5 KP_5 KP_5 KP_5 KP_5
keycode  85 = KP_6 KP_6 KP_6 KP_6 KP_6 KP_6
keycode  79 = KP_7 KP_7 KP_7 KP_7 KP_7 KP_7
keycode  80 = KP_8 KP_8 KP_8 KP_8 KP_8 KP_8
keycode  81 = KP_9 KP_9 KP_9 KP_9 KP_9 KP_9

Repeating keys on a wireless keyboard

Unpair the keyboard and then re-pair it. The trick is to hold down the power button throughout the entire pairing process.

Function keys do not work

If your F<num> keys do not work, this is probably because the kernel driver for the keyboard has defaulted to using the media keys and requiring you to use the Fn key to get to the F<num> keys. To change the behavior temporarily, append 2 to /sys/module/hid_apple/parameters/fnmode. To make the change permanent, set the hid_apple fnmode option to 2.

< and > have changed place with § and ½

If the < and > are switched with the § and ½ keys, set the xkb option apple:badmap, for instance by running the following command in your graphical environment:

$ setxkbmap -option apple:badmap

Alternatively, set the keycodes manually using xmodmap:

keycode  49 = less greater less greater bar brokenbar
keycode  94 = section degree section degree notsign notsign

If you use a Canadian multilingual layout (where the "ù" and the "/" is switch) use this:

keycode  94 = slash backslash slash backslash bar brokenbar
keycode  49 = ugrave Ugrave ugrave Ugrave notsign notsign

< and > have changed place with ^ and ° (or @ and #, or ` and ~)

With German layout, circumflex/degree symbol and </> are exchanged. With French layout, @/# are exchanged. With the US layout, `/~ and </> are exchanged.

To change the behavior temporarily, append 0 to /sys/module/hid_apple/parameters/iso_layout. To make the change permanent, set the hid_apple iso_layout option to 0.

PrintScreen and SysRq

Apple Keyboards have an F13 key instead of a PrintScreen/SysRq key. This means that Alt+SysRq sequences do not work, and application actions associated with PrintScreen (such as taking screenshots in many games that work under Wine) do not work. To fix this, you can add setxkbmap -option "apple:alupckeys" to your .xinitrc. This will map PrintScreen/SysRq to F13, as well as Scroll lock to F14 and Pause to F15.

Alternatively, follow the Map scancodes to keycodes article to map the F13 scancode to the PrintScreen/SysRq keycode, where 458856 (0x070068) is the scancode of F13, and sysrq is the keycode of PrintScreen/SysRq.

Treating Apple keyboards like regular keyboards

If you want to use your Apple keyboard like a regular US-layout keyboard, with Alt on the left side of Meta, you can use the AUR package un-apple-keyboardAUR. Currently it only works for the aluminium USB model. The package does the following things:

  • Adds a /etc/modprobe.d/hid_apple.conf file which enables the F<num> keys by default, as in #Function keys do not work.
  • Uses keyfuzz to remap F13-15 to PrintScreen/SysRq, Scroll Lock, and Pause, respectively.
  • Swaps the ordering of the Alt and Meta (Command) keys to match all other keyboards, again using /etc/modprobe.d/hid_apple.conf, as in #Swap the Alt key and Command key (Meta/Super).
  • Applies these changes automatically when you plug in your keyboard, with a udev rule.

Tango-inaccurate.pngThe factual accuracy of this article or section is disputed.Tango-inaccurate.png

Reason: The udev rule should take care of the keyboard when it is plugged in at boot (Discuss in Talk:Apple Keyboard#)

You will need to add /etc/modprobe.d/hid_apple.conf to FILES in mkinitcpio.conf. Otherwise if you boot your computer with the Apple keyboard plugged in, the the F<num> keys will not work by default.

Swap the Alt key and Command key (Meta/Super)

To change the behavior temporarily, append 1 to /sys/module/hid_apple/parameters/swap_opt_cmd. To make the change permanent, set the hid_apple swap_opt_cmd option to 1.

Swap the Fn key and Left Ctrl key

While the original hid-apple module doesn't have an option to swap the fn and left control keys, there is a patch adding this functionality to the module. To install the patch, install the hid-apple-patched-gitAUR package.

To change the behavior temporarily, append 1 to /sys/module/hid_apple/parameters/swap_fn_leftctrl. To make the change permanent, set the hid_apple swap_fn_leftctrl option to 1.

Note:

See also