Tiny Core Linux
Tiny Core Base => TCB Q&A Forum => Topic started by: khagberg on December 13, 2010, 10:53:19 AM
-
Is there a way to program a function key within Tinycore to have it execute a program. If I press F1 run program /usr/bin/abc F2 run /usr/bin/def
Thanks
-
A possible approach would be to do so with any window manager which allows to define keybindings. Not sure if that serves your purpose.
-
I use actkbd to link function keys to suspend/mute/vol/etc. It's in the repository, courtesy of curaga.
I don't think actkbd can conditionally grab keys, however - so it's always use that key press for your program, or not.
Or ... get the flwm code and edit.
-
I was looking at that and am having trouble figuring out how to trap a function key. Seems to be able to grab special function keys but have not been able to trap the F1 key
-
Hmm. You should be able to trap pretty much anything, given the right keycodes/scancodes.
Get showkey from the repository - it will show you the key codes you need. Install the extension, exit to prompt, get your key codes. You may have to run it sudo.
EDIT: My config file appears at http://www.dentonlt.com/node/225 (http://www.dentonlt.com/node/225), near the bottom.
HTH
-
I grabbed showkey and it says F1 is keycode 59.
I created a config file with
59 :key :grabbed,ungrab :aterm
then loaded up actkbd but nogo on getting aterm to launch on pressing F1
Any hint would be great.
Thanks
-
I created a config file with
59 :key :grabbed,ungrab :aterm
then loaded up actkbd but nogo on getting aterm to launch on pressing F1
Regarding your configuration, that should work. I'd do this, which launches on release instead of press:
59:key:noexec:
59:rep:noexec:
59:rel:exec:aterm
More likely, do you have your /dev/input/eventX items set correctly? I didn't have a way of finding that, so ... I used an actkbd.conf that would respond to any key press (quick correction made - use "not"):
:key:not,exec:echo "press!"
And then ran actkbd individually per /dev/input/event entry:
actkbd -c /my path to/actkbd.conf -d /dev/input/event1
Or something like that. Be careful, of course, or actkbd may grab your keyboard and not give it back...
-
Got it. Thanks
Works like a champ
need to use /dev/input/event4
-
Great to hear :)
-
cd /sys/class/input
for i in input*/name; do echo $i; cat $i; done
input0 is event0 in /dev/input.