Smenu is a project mainly written in C, it's free.
smenu
============== -- outline -- ==============
tevent
What is this?
Commandline programs to run scripts based on events:
license ?
This library is free software; you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free Software Foundation; either version 2.0 of the License, or later version.
This library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details.
You should have received a copy of the GNU Lesser General Public License along with this library; if not, write to the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
How to use kmenu ?
You need to specify the device to watch for events. If no other options are given, all key up/down events will be displayed:
kmenu /dev/input/event0 event scanning
Event: type 1 (EV_KEY), code 2 (KEY_1), value 1 Event: type 0 (EV_SYN), code 0 (EV_SYN), value 0
Event: type 1 (EV_KEY), code 2 (KEY_1), value 0 Event: type 0 (EV_SYN), code 0 (EV_SYN), value 0 ...
Below is the example, it works as... KEY_1 pressed : print "hallo world", KEY_2 pressed : run "ls" command, KEY_3 pressed : exit kmenu,
kmenu /dev/input/event0 2 1 "echo hallo world" 3 1 "ls" 4 1 0
where 2, 3, 4 are the code for KEY_1, KEY_2, KEY_3, and 1 means "pressed".
The following will retrieve one of two key codes into a variable:
KEY=
kmenu /dev/input/event0 -e 21 1 "echo y;false" 49 1 "echo n;false"
Note that kmenu (and tmenu) will stop scanning for events if the -e option is given and the script that's run returns a non-zero exit code.
kmenu can read from more than one event device at once if each event file is prefixed with -f, e.g.
kmenu -f /dev/input/event0 -f /dev/input/event1 4 1 0 272 1 program
Events will match when they come from any device, so keyboard presses can be combined with mouse clicks, for example.
How to use tmenu ?
You need to specify the device to watch for events. If no other options are given, the screen status will be monitored:
tmenu /dev/input/event1 event scanning
Event: type 3 (EV_ABS), code 0 (ABS_X), value 2592 Event: type 3 (EV_ABS), code 24 (ABS_PRESSURE), value 168 Event: type 0 (EV_SYN), code 0 (EV_SYN), value 0
Event: type 3 (EV_ABS), code 0 (ABS_X), value 2489 Event: type 3 (EV_ABS), code 1 (ABS_Y), value 1712 ....
Below is the example, when a press occurs in... (x, y) = (1500, 1500), region = 500 : print "hallo world" (x, y) = ( 800, 500), region = 300 : run "ls" (x, y) = ( 100, 100), region = 100 : exit tmenu
tmenu /dev/input/event1 1500 1500 500 "echo hallo world" 800 500 300 "ls" 100 100 100 0
How to link statically ?
EXTR=-static make