Changing the default Function key behaviour in Fedora

If you use Apple Mac hardware running Fedora, you may be one of those people wondering how to change the default behaviour of your top Function keys. On Apple keyboards, the default is to have the brightness,volume control and audio play/pause buttons the default by suppressing the F1-F12 keys.

I do find that quite handy, however I use the F1-F12 keys much more frequently than the default Apple buttons.

This post will show you how to switch the default behaviour from having to press Fn + F(key) to simply pressing the F(key).

In Fedora 18 / 19 (which uses systemd), you will need to do the following.

1. Create a new file for SystemD to start.

vi /usr/lib/systemd/system/mac-keyboard.service

Ensure the file contains the following

[Unit]
 Description=mac-keyboard
[Service]
 Type=oneshot
 ExecStart=/bin/sh -c "echo 2 > /sys/module/hid_apple/parameters/fnmode"
 ExecStop=/bin/sh -c "echo 1 > /sys/module/hid_apple/parameters/fnmode"
 RemainAfterExit=yes
[Install]
 WantedBy=multi-user.target

 

2. Reload SystemD to read your new file

systemctl --system daemon-reload

 

3. Start the SystemD service.

systemctl start mac-keyboard.service

 

4. Enable service to start on boot.

systemctl enable mac-keyboard.service

 

For other older systems not yet running SystemD (RHEL/CentOS/Older versions of Fedora), please use the following steps.

1. Edit /etc/rc.local

vi /etc/rc.local

Ensure you have added the below line to the end of the file.

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

 

2. To apply without rebooting, run the following from a root shell.

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

 

One comment on “Changing the default Function key behaviour in Fedora

  1. Sergei June 26, 2016 16:34

    Thank you! but I think it’s better to create mac-keyboard.service in /etc/systemd/system.

Leave a Reply

Your email address will not be published.

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <s> <strike> <strong>