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 Theresa, posted on 15 Jan 2024, 21:55


Do you sometimes find yourself in a tug of war between work and fitness? We have the perfect solution for you - Elebands!

Elebands offers ultra-thin, fashionable all day wearable body weight bands that seamlessly integrate into your daily routine. Burn up to 1,500 calories a day by simply wearing our bands on your wrist, ankle, and waist while you go about your normal day.

The best part is we have full body weight sets ranging from 3lbs – 30lbs to ensure optimal results no matter what your fitness goals are.

Plus! We have bands for sports, casual, and formal occasions that you can wear with any outfit, ensuring you stay stylish while achieving your fitness goals.

With Elebands, you no longer have to choose between work and exercise. Our body weight bands enable you to lose weight and get fit regardless of your location or activity. Enjoy these instant benefits:

1. Burn Calories: Effortlessly burn up to 1,500 calories daily, toning your body as you go about your day.

2. Natural Weight Loss: Say goodbye to intense workouts and stressful diets. Elebands helps you lose weight naturally.

3. Build Strength: Develop lean muscles and enhance your strength as you carry out your regular activities.

Imagine achieving your dream body without stepping foot in a gym or following a strict diet plan. With Elebands, it's possible.

Many of our clients are losing 2-3 pounds per week while experiencing significant health improvements. To help you get started for the NEW YEAR, use coupon code SAVE-20%-TODAY for a 20% discount.

Visit our website now at and embrace the Elebands experience.

Let Elebands be your partner in achieving a fit and healthy lifestyle. Start your transformation today!

Warm regards,

Theresa Smith
Brand Ambassador
Elebands USA

Visit our website NOW!

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

Calculate: fะพrty-nine minus eight = (type the answer in digits)


Valid XHTML 1.0 Strict