January 5, 2009

Apple Keyboard on Ubuntu 8.10




I have 'Wired USB slim aluminium Apple keyboard'. Its design is stunning and it types very smoothly; however, since the keyboard uses slightly different keycodes, some works needed to be done to use it on Ubuntu.

First, [alt] doesn't work as it is: it needs to be pressed with [fn] in order to act as [alt] in PC. Here is how to fix it.

$ sudo vi /etc/modprobe.d/options
> options hid pb_fnmode=2
$ sudo update-initramfs -u

Second, some may find it convenient to have [alt] and [cmd] switched. I personally prefer not to switch them (and it can be done by using compiz manager) but in case you need, here is how to.

Third, if you configured the keyboard layout (Menu -> System -> Preferences -> Keyboard -> Layouts) as 'Generic 102-key', you won't be able to use [F13] ~ [F19]. To overcome this, you need to add the following keycodes.

$ vi ~/.xmodmap
> keycode 191 = Insert
> keycode 192 = Print Sys_Req
> keycode 193 = Scroll_Lock
> keycode 194 = F16
> keycode 195 = F17
> keycode 196 = F18
> keycode 197 = F19

The script assigns F13 to 'Insert', F14 to 'PrintScr', F15 to 'ScrollLock', and so on. Now, you can use the keycodes to configure system shortcuts (Menu -> System -> Preferences -> Keyboard Shortcuts), or to create your own shortcuts.

No comments: