[NC10] How to map the remaining non-working FN keys

Discussions about Linux installation and configuration on Samsung laptops
Post Reply
User avatar
voria
Administrator
Administrator
Posts: 1383
Joined: 12 Feb 2009, 18:08
Location: Italy
Contact:

[NC10] How to map the remaining non-working FN keys

Post by voria »

To enable all the FN keys on NC10 we simply need to install a fixed kernel and edit an HAL file (Here is the howto).

However, even if the keys are all enabled, on Ubuntu 8.10 some of them are not mapped by default. So, let's see how to map them.

I will just explain how to map the FN-F5 and FN-F8 keys to replicate the same functionalities they have on windows xp. For all the other keys it works the same way, just adapt the commands to your needs. You can map any key (not only the FN keys) to any program or script you need. :)

Let's start with FN-F5. It will toggle the screen brightness on/off (note: if you are using my repository and you installed the nc10-scripts package, then the key is already mapped; however I leave it here just as an example for how to map other keys).

First of all, we have to install the xbacklight package from ubuntu repositories because we are going to use a script that needs it to work.
Once installed, download the script, make it executable and put it in /usr/local/bin.

Now, map it to the FN-F5 key with the following commands:

Code: Select all

gconftool-2 -s --type string /apps/metacity/keybinding_commands/command_1 '/usr/local/bin/lcdonoff.sh'
gconftool-2 -s --type string /apps/metacity/global_keybindings/run_command_1 XF86Launch1
The first one will put the /usr/local/bin/lcdonoff.sh in the command_1 position, the second one will enable the XF86Launch1 key (ie FN-F5) to launch the command_1.

We are done. Not so difficult, eh? :D

Now the FN-F8 key. It will switch the CPU governor between ondemand, performance and powersave governors.

Download this script, make it executable and put it in /usr/local/bin (as usual).
It needs the libnotify-bin package to show popups, so be sure it's installed. Besides that, it needs admin rights to work so we have to use sudo to run it.
However, we don't want to insert the password everytime we run the script, so we'll add a new rule to sudo to run it with no need to insert the password (exactly as done for the wireless card here).

In a terminal, run the command

Code: Select all

sudo visudo
to open the sudo configuration file.

Go to the line

Code: Select all

# Cmnd alias specification
and below it add this one:

Code: Select all

Cmnd_Alias      CPUSCALING=/usr/local/bin/cpuscaling.sh
Now go to the end of file and add this line:

Code: Select all

%admin ALL=(ALL) NOPASSWD: CPUSCALING
Exit (CTRL+x) and save the file.
Due to this new rule, all the users in admin group can run the CPUSCALING command (and ONLY this command) with no need for the password.

Now, map the script to the FN-F8 key with the following commands:

Code: Select all

gconftool-2 -s --type string /apps/metacity/keybinding_commands/command_3 'sudo /usr/local/bin/cpuscaling.sh'
gconftool-2 -s --type string /apps/metacity/global_keybindings/run_command_3 XF86Launch3
Done.
If you press the key once, a popup will show the governor in use. If you continue to press the key, the governor will be changed.

Now, using the same method, bind all the other keys to what you want. For example, on my installation the FN-F3 key opens a terminal, FN-F7 launches eclipse and FN-F8 launches devhelp (I simply don't need to handle the cpu governors, I just leave it to 'ondemand' all the times. So I used the key for other stuff :)).

Ok, that's all. For any question or problem, ask here. :)
Last edited by voria on 05 May 2009, 11:31, edited 1 time in total.
Image
Please consider a little donation to keep the 'Linux On My Samsung' project up and running. Thank you!
mbt28
Newbie
Newbie
Posts: 31
Joined: 23 Apr 2009, 11:18

RE: [NC10] How to map the remaining non-working FN keys

Post by mbt28 »

XF86WLAN wont works for me, when i look fn-f9 keykode in xev, i cant see anything useful. Why xmodmap doesnt know XF86WLAN ?
I solve this problem, i edited icewm keys file and i changed wlan command and its worked. If the command is wrong icewm disables key.
Last edited by mbt28 on 24 Apr 2009, 16:40, edited 1 time in total.
tkoorn
Newbie
Newbie
Posts: 9
Joined: 23 Apr 2009, 16:35

RE: [NC10] How to map the remaining non-working FN keys

Post by tkoorn »

I am having a problem with the fn-f5 script. It blacks out the screen as it should, but when I use the setting "dim on idle" in power manager, the display comes back on when idle. looks like the dim on idle just sets some value instead of decreasing the brightness from where it is.
Last edited by tkoorn on 25 Apr 2009, 02:07, edited 1 time in total.
User avatar
voria
Administrator
Administrator
Posts: 1383
Joined: 12 Feb 2009, 18:08
Location: Italy
Contact:

RE: [NC10] How to map the remaining non-working FN keys

Post by voria »

'tkoorn' pid='834' dateline='1240621588' wrote: I am having a problem with the fn-f5 script. It blacks out the screen as it should, but when I use the setting "dim on idle" in power manager, the display comes back on when idle. looks like the dim on idle just sets some value instead of decreasing the brightness from where it is.
Fixed with the new 'lcdonoff.sh' script included in 'nc10-scripts' package (0.3~ppa2~nc10~jaunty) on my repository.

Changelog:

Code: Select all

* New 'lcdonoff.sh' script: xbacklight is not used anymore, gnome-power-manager is used instead.
* Dropped xbacklight dependency.
Last edited by voria on 25 Apr 2009, 18:21, edited 1 time in total.
Image
Please consider a little donation to keep the 'Linux On My Samsung' project up and running. Thank you!
User avatar
voria
Administrator
Administrator
Posts: 1383
Joined: 12 Feb 2009, 18:08
Location: Italy
Contact:

RE: [NC10] How to map the remaining non-working FN keys

Post by voria »

Ok, sometimes the new 'lcdonoff.sh' script messed up the gpm settings, so the old one is back with slight modifications.

Here is the changelog (0.3~ppa3~nc10~jaunty):

Code: Select all

* Revert: "New 'lcdonoff.sh' script: xbacklight is not used anymore, gnome-power-manager is used instead."
* xbacklight dependency readded.
* 'lcdonoff.sh' script now disables/enables the gnome-power-manager 'idle_dim' options when needed in order to avoid unwanted screen resume.
Image
Please consider a little donation to keep the 'Linux On My Samsung' project up and running. Thank you!
mbt28
Newbie
Newbie
Posts: 31
Joined: 23 Apr 2009, 11:18

RE: [NC10] How to map the remaining non-working FN keys

Post by mbt28 »

'voRia' pid='845' dateline='1240686013' wrote: Ok, sometimes the new 'lcdonoff.sh' script messed up the gpm settings, so the old one is back with slight modifications.

Here is the changelog (0.3~ppa3~nc10~jaunty):

Code: Select all

* Revert: "New 'lcdonoff.sh' script: xbacklight is not used anymore, gnome-power-manager is used instead."
* xbacklight dependency readded.
* 'lcdonoff.sh' script now disables/enables the gnome-power-manager 'idle_dim' options when needed in order to avoid unwanted screen resume.
I think dont remove old lcdonoff.sh, maybe someone uses it with kde, lxde, or other window managers.
Post Reply