Archives pour 12/2015

AppleKeyboard on Ubuntu

07/12/2015 Comments off



Since Ubuntu 8.04 (Hardy Heron) the USB aluminum Apple Keyboard has not worked correctly. A change was added to the Ubuntu Linux kernel to make Apple MacBook keyboards gain additional functionality to their limited laptop style keyboard (Ubuntu bug #162083). Unfortunately this code change has some side effects for owners of the full size USB aluminum Apple Keyboard:

  • Function keys have media functions as default (as the printing on the keycaps indicates). To access the regular F-key functionality, the « fn » key must be pressed and held (except for F5 and F6, which are inverted in this respect). (Ubuntu bug #201711)
  • On international (non-US) keyboards, two keys are swapped with respect to the printing on the keycaps. (Ubuntu bug #214786)

Both issues may be straightened out with two configurable module parameters (, as shown below.

To make the keyboard behave more like a standard PC keyboard (but against the orinal printing on the keycaps), additional steps are necessary:

  • Map SysRQ, Scoll Lock, and Pause keys to F13-F15: This still requires a patch that adds a configurable option to the kernel module, or a « keyfuzz » workaround (#262408).
  • Swap the cmd and super keys: (hid_apple patch) or keyfuzz workaround.

A tar archive containing all workarounds can be found at (un-apple-keyboard)

If you would like to have a better integration, please help by enhancing the patches to implement proper module parameters, and submitting them to the upstream kernel developers. See also: Trouble With Apple Keyboard On Ubuntu

To find the the keycode of any key that you want to modify, simply run in a terminal

xev | sed -n ‘s/^.*keycode *\([0-9]\+\).*$/keycode \1 = /p’

Then you can find the List of Keysyms Recognised by Xmodmap:

Default Behavior

This section describe the default behavior of every Apple keyboard.

Apple slim aluminum keyboard (0220)


  • Characters that are not printed on the keycaps (~,{},[],…) can still be generated as on a standard PC keyboard.
  • Even if the @ is printed on another keycap as on the standard PC layout, that key will only behave like the standard PC layout key and not generate the @. Use your localized standard PC layout key (combination) to generate the @.
  • ‘fn’+’F-Key’ -> triggers the regular F-Key
  • ‘fn’+’Enter’ -> Insert
  • ‘fn’+’Backspace’ -> Delete
  • ‘fn’+’Up’ -> PageUp
  • ‘fn’+’Down’ -> PageDown
  • ‘fn’+’Left’ -> Home
  • ‘fn’+’Right’ -> End
  • ‘Clear’ behaves like ‘NumLock‘ (Numlock may also be switched by pressing fn-F6 twice)

(See #262408 as there is patch submit to map F13, F14 and F15 to the otherwise missing PrintScreen, ScrollLock and Pause keys.)

Lire la suite…