HOWTO: Make The Function Keys Work On An Apple Keyboard

From Sabayon Wiki
Jump to: navigation, search
i18n: en tr

The fn key on an Apple keyboard

Apple keyboards have a row of keys at the top that serve two purposes. They are the multimedia keys (Volume, Play/Pause, etc) and they are the normal F1-F12 function keys. If you press one of the keys without using the "fn" key as a modifier, it will act as a multimedia key. You must press fn-F1 to send an actual F1 to Sabayon Linux. While this is probably fine for Mac OS, where the function keys are rarely used, it's a little awkward for use under Linux. For example: You must press fn-Control-Option(alt)-F1 to switch to the first virtual terminal, which almost requires 3 hands.

Reversing the way the fn key works

Fortunately, the Apple keyboard driver in Sabayon Linux is capable of reversing the function of those keys. You can change the driver's behavior by executing a simple command as root:

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

This tells the driver that you want the keys at the top of the keyboard to be function keys (F1-F12) by default, and to require the fn key for the multimedia functions. The effect is immediate. Unfortunately, if you want this to be the default, without running that command every time you reboot, you have to do a little bit more work.

Making the change permanent

You will need to execute the above command each time you reboot your system. The easiest way to do this is to add it to your /etc/conf.d/local script. This script gets run at startup and at shutdown and allows you to add simple commands to be run at those times. You will want to add it to the local_start() function, before the "return 0" line:

File: /etc/conf.d/local
local_start() {
	# This is a good place to load any misc programs
	# on startup (use &>/dev/null to hide output)

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

	# We should always return 0
	return 0

That's it. Your function keys should now behave normally, and you will need to use the fn key for the multimedia keys.