Using Apple's Aluminium Keyboard on Linux

~ 26 Sep 2010, 02:39

Here's a mini-HOWTO on the tweaks and hacks to turn the beautiful-but-temperament Apple aluminium keyboard into a PC-compatible one. Having used this gem for about an year now, I can testify: it's, without a doubt, the best keyboard I've ever worked with. It's comfort, quiet, fast, compact, prompts you to keep your fingernails short... you name it :)

The only hitch turns out to be the weird key locations of some symbols, and some Mac-influenced behaviour. You don't have an Insert button, there's a "Fn" button instead (see the picture above); F-keys don't behave as such, but rather do something (e.g., F12 is "volume up"); the numpad keys +, -, *, / are totally different; the key on the left of '1' is strange, it's not a tilde; and, the most painful thing - the Alt and Win keys are swapped (Alt is no more to the left of Space, but one key further left).

Fedora 13 applies the following logic in regard to these PC/Mac mismatches - a key does exactly what is written on it; even if that's different from what all people are used to do. Personally, I find that unacceptable, so here's how I restored a PC-compatible behaviour of the Apple keyboard:

1) Add the following two lines in /etc/rc.local:

echo "2" > /sys/module/hid_apple/parameters/fnmode
echo "0" > /sys/module/hid_apple/parameters/iso_layout

The first line makes the F-keys behave as real F-keys. To access the "action", combine with the "Fn" key. E.g., Fn + F12 turns the volume up.
The second line resolves the tilde issue, among other things.

2) Swapping the Alt and Win keys is best done by modifying the XKB scan-code interpretation file directly:
2.1) In Gnome->Preferences->Keyboard->Layouts, select "Evdev-managed keyboard" as your keyboard device.
2.2) Open /usr/share/X11/xkb/keycodes/evdev in a text editor. Search for any lines of the form "<LALT> = number", "<LWIN> = other number". Now you need to swap the numbers, corresponding to LALT and LWIN, and similarly for RALT and RWIN.
2.3) Restart X.

And that's it! Voilà!


#1 by rado, posted on 6 Dec 2010, 13:18

u have to save that evdev file somewhere as a backup, otherwise your changes will disappear on the next fedora X11-related update, which overwrites those files.

#2 by Bauerspule, posted on 10 Jan 2014, 18:29

echo "1" > /sys/module/hid_apple/parameters/swap_opt_cmd on my Linux 3.12. :)


#3 by anrieff, posted on 14 Jan 2014, 13:08

Wow, this makes it much easier. And yet another reason why I love Linux :)

#4 by John, posted on 25 Jan 2014, 02:33

Thank you for this! I was struggling to find the keycodes to the F1 - F12 keys in Fedora 20. Using the fnmode change easily fixed everything in one place.

#5 by Ondo, posted on 31 Jan 2014, 19:39

Is the opposite possible? By this obscure question I mean the following:

I am a Linux Mint user and I want to use the Apple keyboard as it is born. I want the keys to be what is written on them, but the Ubuntu Linux family does what you want: turn it into a PC-keyboard. The Apple key layout is least in my language very superior to the PC-layout - mileage probably varies by language.
So, in brief, can the Fedora solution to native support of the Apple keyboard be transferred to Linux Mint, or other Ubuntu's?

#6 by anrieff, posted on 1 Feb 2014, 02:18

I guess yes, look for the files in /sys/module/hid_apple/parameters for the FN keys and the likes.
As per the keycode mapping - you can do the same hacks with the evdev file. Let me know if this works for you, as I haven't attempted running the apple keyboard on Ubuntu :)

#7 by Speedy Cash , posted on 26 Apr 2018, 14:47

cash now <a href="">need money now</a> cash now <a href=>cash now</a>

#8 by allstate insurance , posted on 26 Apr 2018, 18:07

insurance for cars <a href="">car insurance for young drivers</a> texas auto insurance <a href=>cheap auto insurance in nj</a>

#9 by ins , posted on 25 Apr 2018, 06:32

auto insurance <a href="">auto insurance</a> extremely cheap car insurance <a href=>auto insurance</a>

#10 by Quick Loan , posted on 25 Apr 2018, 01:43

lenders <a href="">lenders</a> no credit loans guaranteed approval <a href=>loans in arizona</a>

#11 by Payday Loan Online , posted on 24 Apr 2018, 23:25

cash now <a href="">i need money now</a> cash now <a href=>cash loans online</a>

#12 by Writing Essay Online , posted on 24 Apr 2018, 22:30

college essays 2016 <a href="">excellent essay writings</a> persuasive essay titles <a href=>writing my essay</a>

#13 by car insurances , posted on 24 Apr 2018, 13:37

car insurance quotes online comparison <a href="">best insurance</a> cheap car insurance in alabama <a href=>travelers auto insurance</a>

#14 by Buy An Essays , posted on 24 Apr 2018, 05:36

essay mistake <a href="">good argument essays</a> write my essay for me <a href=>college essay model</a>

#15 by insurance rates , posted on 24 Apr 2018, 02:35

top rated auto insurance companies <a href="">auto insurance</a> auto insurance companies <a href=>top rated auto insurance companies</a>

Contact: (Link to your blog/website/e-mail; not obligatory)
Your comment:

Calculate: fifty-six plus thirty-six = (type the answer in digits)


Valid XHTML 1.0 Strict