Making a special key do a command Gentoo Linux (commandline!)

1

I have Gentoo installed on my MacBookPro7.1 (nVidia graphics card). With pommed, i can use the kb lights up and down buttons, also the volume up/down/mute buttons with alsa and the LCD backlight down button, but i couldn't find no way to get the LCD backlight up button to..

So i tried it by hand: I made a backlight_up script:

#!/bin/bash
BRPATH="/sys/class/backlight/nvidia_backlight"
MAX=`cat $BRPATH/max_brightness`
CURRENT=`cat $BRPATH/brightness`
NEW=$[CURRENT+10]
if [ $NEW -gt $MAX ]
  then
    NEW=$MAX
fi
echo -n $NEW > $BRPATH/brightness

I looked up for the keycode of the VolumeUp button with showkey.. it resulted "225", so i made a backlightup.keymap:

keycode 225 = F100
string F100 = "/usr/bin/backlight_up\n"

Then i made loadkeys backlightup.keymap It resulted that, when i press the button, it increases the backlight, but also has the annoying output... I would like it to happen in the background, without any output.. I also tried it with bind, but i failed to find out the keyseq of the button (ctrl + v or ctrl + m followed by the button failed for me, just nothing happened).

With X, i can tricky tame it to work, but i don't want to use X, i prefer the command-line.. This isn't a big problem, as i'm not changing the backlight all the time, but you know.. i would like everything to work properly..

Many thanks in advance, Adam

AdamK

Posted 2014-06-10T22:38:32.833

Reputation: 29

No answers