MacBook 上修改Ubuntu系统fn功能键
Change Function Key behavior
This section of the document describe how to change the behavior of 'fn' key to better match what user expect. (See #201711, #162083)
Here a description of each behavior :
- 0 = disabled : Disable the 'fn' key. Pressing 'fn'+'F8' will behave like you only press 'F8'
- 1 = fkeyslast : Function keys are used as last key. Pressing 'F8' key will act as a special key. Pressing 'fn'+'F8' will behave like a F8.
- 2 = fkeysfirst : Function keys are used as first key. Pressing 'F8' key will behave like a F8. Pressing 'fn'+'F8' will act as special key (play/pause).
Ubuntu 9.04 to 12.04 LTS (Precise Pangolin)
Temporarily
The following command will change the behaviour of 'fn' key with immediate effect, but restarting will reset the configuration:
$ echo 2 | sudo tee /sys/module/hid_apple/parameters/fnmode
(The meaning of fnmode values is as described in the preceding section.)
Permanently
Methods described in this section will change the behavior permanently. There are several ways to proceed with this modification. Each sub-section describes one way to permanently change the configuration.
With .conf file (Recommended)
1. Run the following command to append the configuration line to the file /etc/modprobe.d/hid_apple.conf creating it if necessary:
$ echo options hid_apple fnmode=2 | sudo tee -a /etc/modprobe.d/hid_apple.conf
2. Trigger copying the configuration into the initramfs bootfile.
$ sudo update-initramfs -u -k all
3. Optionally, reboot
$ sudo reboot
With sysfs.conf
1. Edit the /etc/sysfs.conf file, creating it if necessary.
gksudo gedit /etc/sysfs.conf
2. Add this lines to the end of the file.
module/hid_apple/parameters/fnmode = 2
3. Reboot
With rc.local
This methods simply automatically applies during startup the technique used to change fnmode temporarily.
1. Edit the /etc/rc.local file.
gksudo gedit /etc/rc.local
2. Add this line near the end of the file, before the "exit" line:
echo 2 > /sys/module/hid_apple/parameters/fnmode
3. Reboot
Ubuntu 8.10 (Intrepid Ibex)
Temporarily
With immediate effect, try
sudo bash echo 2 > /sys/module/hid/parameters/pb_fnmode exit
Permanently
1. Edit the file /etc/modprobe.d/options, e.g.:
gksudo gedit /etc/modprobe.d/options
2. Add the line:
options hid pb_fnmode=2
3. Save the file and execute the following command:
sudo update-initramfs -u
4. Reboot
Alternatively, you can modify /etc/rc.local to similar effect.
* Edit the /etc/rc.local file:
gksudo gedit /etc/rc.local
* Add this line to the end of the file:
echo 2 > /sys/module/hid/parameters/pb_fnmode
Alternatively, you can modify /etc/sysfs.conf to similar effect.
* Edit the /etc/sysfs.conf file:
gksudo gedit /etc/sysfs.conf
* Add this lines to the end of the file:
module/hid/parameters/pb_fnmode = 2
echo 0 > /sys/module/hid_apple/parameters/fnmode
The above will prevent you from having to reboot. Adding the option is a good idea, so the change persists through reboots.
- 0 = Fn key disabled
- 1 = Fn key pressed by default
- 2 = Fn key released by default
From /drivers/hid/hid-apple.c
line 42:
Mode of fn key on Apple keyboards (0 = disabled, [1] = fkeyslast, 2 = fkeysfirst)
The answer above about what option to set in /etc/modprobe.d
is a bit out of date. Fortunately there is detailed documentation on the Apple Keyboard support:
Edit or create the file /etc/modprobe.d/hid_apple.conf, e.g.:
gksudo gedit /etc/modprobe.d/hid_apple.conf
Add this line to the previously open file.
options hid_apple fnmode=2
Save the file and execute the following command to notify hid_apple module to reload it's configuration.
sudo update-initramfs -u
- Reboot
I'd personally recommend sudo update-initramfs -u -k all
to update it for all your kernels (once you are confident the setting works as expected).
Setting the fnmode under /sys
still works the same way:
sudo -s 'echo 2 > /sys/module/hid_apple/parameters/fnmode'
The values in both methods are as follows:
- 0 = disabled : Disable the 'fn' key. Pressing 'fn'+'F8' will behave like you only press 'F8'
- 1 = fkeyslast : Function keys are used as last key. Pressing 'F8' key will act as a special key. Pressing 'fn'+'F8' will behave like a F8.
- 2 = fkeysfirst : Function keys are used as first key. Pressing 'F8' key will behave like a F8. Pressing 'fn'+'F8' will act as special key (play/pause)
参考推荐:
版权所有: 本文系米扑博客原创、转载、摘录,或修订后发表,最后更新于 2014-07-01 20:04:29
侵权处理: 本个人博客,不盈利,若侵犯了您的作品权,请联系博主删除,莫恶意,索钱财,感谢!