个人工具

UbuntuHelp:AppleKeyboard

来自Ubuntu中文

Wikibot讨论 | 贡献2008年10月19日 (日) 14:13的版本

跳转至: 导航, 搜索


Preface

Since Ubuntu 8.04 (Hardy Heron) the USB aluminium 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 aluminium Apple Keyboard:

  • Function keys have media functions as default. The "fn" key must be pressed and held to access the F-key functionality (except F5 and F6, which are inverted in this respect). (Ubuntu bug #201711)
  • Num lock key will when pressed render the keyboard seemingly unusable. The keyboard will simulate a numeric keypad on the alphabet keys. Pressing F6 twice will exit this mode. (Ubuntu bug #201887)
  • Two keys are swapped on international (non-US) keyboard with respect to the printing on the keycaps. (Ubuntu bug #214786)
  • Bug filled by me in the main kernel bugzilla http://bugzilla.kernel.org/show_bug.cgi?id=10818 Please help if you think (as I) that the kernel developers are wrong, assuming that the keyboard have to behave like under MacOS.

Corrections

Correcting the Function Key and Num Lock issue

  • Edit the file /etc/modprobe.d/options, e.g.:
sudo gedit /etc/modprobe.d/options
  • Add the line: options hid pb_fnmode=0
  • Save the file and execute the following command:
sudo update-initramfs -u
  • Reboot

Adding an Insert key, swapping Alt/Cmd positions and more

To make the keyboard work more like a normal PC keyboard add the following to your ~/.Xmodmap file. Add the file if there is none.

! Configure F13 as Insert key, F14 as PrintScr, F15 as ScrollLock
! and F16 as Pause/Break.
keycode 182 = Insert
keycode 183  =  Print       Sys_Req
keycode 184  =  Scroll_Lock
keycode 93   =  Pause   Break

! Swap Alt and Cmd keys.
keycode 0x25 =  Control_L
keycode 0x73 =  Alt_L       Meta_L
keycode 0x40 =  Super_L
keycode 0x71 =  Super_R
keycode 0x74 =  ISO_Level3_Shift    Multi_key
keycode 0x75 =  NoSymbol
keycode 0x6D =  Control_R   Multi_key
clear Shift
clear Lock
clear Control
clear Mod1
clear Mod2
clear Mod3
clear Mod4
clear Mod5
add    Shift   = Shift_L Shift_R
add    Lock    = Caps_Lock
add    Control = Control_L Control_R
add    Mod1    = 0 Alt_L 0x007D
add    Mod2    = Num_Lock
add    Mod4    = Super_L Super_R
add    Mod5    = Mode_switch ISO_Level3_Shift ISO_Level3_Shift ISO_Level3_Shift

! Configure F17 as F13, F18 as F14 and F19 as F15.
keycode 131  =  F13
keycode 247  =  F14
keycode 132  =  F15

! Configure '=' key on numpad as '='.
keycode 0x9D =  equal

After the next login the keys should function as described in the file. You can also manually activate the new layout by calling

xmodmap ~/.Xmodmap

from the command line.

Correcting the two swapped keys for international (non-US) keyboards

  • Open the 'System->Preferences->Keyboard' dialog
  • Choose the 'Layouts' tab
  • Press 'Layout Options...'
  • Navigate to 'Miscellaneous compatibility options'
  • Enable the option: Swap keycodes of two keys when Mac keyboards are misdetected by kernel.

Belgian Macintosh Keyboard Layout

Take a look at https://help.ubuntu.com/community/Macbook_Air#head-5fd0bcf04cc7da0b5241950916bab5d58cdb84da in the Belgian Keyboard section

Postscript

These issues may also apply for the Bluetooth aluminium Apple Wireless Keyboard.