This is a general approach to enable the fn+somekey function work.
Lets take into consideration of fn+f1 that enables and disables my wireless adapter. I checked first the syslog output
$ tail -f /var/log/syslog
Use ‘setkeycodes e02c <keycode>’ to make it known
Yours may be different that e02c. We should define a keycode for this scan code. e056 is the scancode that our kernel is detected. Open the file /usr/share/hotkey-setup/key-constants and take one the key constants that looks suitable to you. setkeycodes should be run with sudo so to try it is working
$ sudo setkeycodes e02c 218
Press the key combination to see whether your X detects the code for the keys after defining the kernel keycodes. You should see the keycodes defined for your key combination. It will be different than 218. Take the x keycode and use it at Xmodmap file.
Create a file under /etc/X11/ with the name Xmodmap.
Just write the keycodes you want to assign something like:
keycode 243 = XF86Launch3
XF86Launch3 is taken from /usr/share/X11/XKeysymDB. Choose an unassigned keysymbol name. XF86Launch onesÂ seem ok.
Then by using gconf-editor define a script to run. So first define XF86Launch3 at the /apps/metacity/global_keybindings/run_command_3 value part. Then define a script path for the value of /apps/metacity/keybinding_commands/command_3. You may create a script that will enable or disable wireless under /usr/loca/bin like
dbus-send –system –type=method_call –dest=org.freedesktop.NetworkManager /org/freedesktop/NetworkManager org.freedesktop.NetworkManager.setWirelessEnabled boolean:true
so just write /usr/local/bin/somescritname.sh at the value part.
Go to terminal windows and write update-gconf-defaults to make your effects work. When you press the key combination the script will launch.