|
| 1 | +actkbd - A keyboard shortcut daemon |
| 2 | + |
| 3 | + |
| 4 | + |
| 5 | +Contents: |
| 6 | + |
| 7 | + 1. Introduction |
| 8 | + 2. Platforms |
| 9 | + 3. Setup |
| 10 | + 3.1. Compilation |
| 11 | + 3.2. Installation |
| 12 | + 3.3. Configuration |
| 13 | + 3.4. Running |
| 14 | + 4. Internals |
| 15 | + 5. License |
| 16 | + 6. Authors |
| 17 | + |
| 18 | + |
| 19 | +1. Introduction |
| 20 | + |
| 21 | +actkbd is a simple daemon that binds actions to keyboard events. It recognises |
| 22 | +key combinations and can handle press, repeat and release events. Currently it |
| 23 | +only supports the linux-2.6 evdev interface, but the platform-specific code is |
| 24 | +well-contained, so that support for additional platforms can be added with no |
| 25 | +or minimal changes to the rest of the code. |
| 26 | + |
| 27 | +It uses a plain-text configuration file which contains all the bindings. Its |
| 28 | +file format has some prediction for command modules, which would allow the user |
| 29 | +to perform some common actions (e.g. eject the CD-ROM or change the volume) |
| 30 | +without having to call external commands. Currently, though, actkbd can only |
| 31 | +execute external commands. |
| 32 | + |
| 33 | + |
| 34 | + |
| 35 | +2. Platforms |
| 36 | + |
| 37 | +Currently only the following platforms are supported: |
| 38 | + |
| 39 | +* Linux 2.6.x |
| 40 | + |
| 41 | +The following platforms will probably never be supported: |
| 42 | + |
| 43 | +* Windows - no POSIX, no support |
| 44 | +* BeOS - unless someone can resurrect it |
| 45 | + |
| 46 | + |
| 47 | + |
| 48 | +3. Setup |
| 49 | + |
| 50 | +3.1. Compilation |
| 51 | + |
| 52 | +A simple call to `make' is normally all you need to compile actkbd: |
| 53 | + |
| 54 | +$ make |
| 55 | + |
| 56 | +You can override the CFLAGS variable to provide optimisation flags e.t.c. The |
| 57 | +DEBUG variable can be used to enable debugging - if you are using gcc, setting |
| 58 | +DEBUG to "-g" would probably do. |
| 59 | + |
| 60 | + |
| 61 | +3.2. Installation |
| 62 | + |
| 63 | +First verify with `make -n install' the installation paths. By default, the |
| 64 | +installation prefix is /usr/local and the actkbd daemon binary is installed in |
| 65 | +$(prefix)/sbin. You can set the prefix and sbindir variables to override these |
| 66 | +defaults. Then run `make install' as root to perform the actual installation: |
| 67 | + |
| 68 | +# make install |
| 69 | + |
| 70 | + |
| 71 | +3.3. Configuration |
| 72 | + |
| 73 | +The default configuration file resides in /etc/actkbd.conf. It is a plain-text |
| 74 | +file with each line being an entry. A proper entry has the following format: |
| 75 | + |
| 76 | +<keys>:<event type>:<command module>:<command> |
| 77 | + |
| 78 | +The <keys> field is a series of numeric keycodes, separated by the `+' |
| 79 | +character. `actkbd -n -s' can be used to find out any keycodes you need. |
| 80 | + |
| 81 | +The <event type> string field is one of `key' (key press event), `rep' (key |
| 82 | +repeat event) or `rel' (key release event). If empty, it defaults to `key'. |
| 83 | + |
| 84 | +The <command module> field is currently ignored. |
| 85 | + |
| 86 | +The <command> field is the executed command that will be passed to system(). Note |
| 87 | +that in order to have non-blocking behaviour, you have to append the `&' character |
| 88 | +to the command, so that /bin/sh will execute it in the background. |
| 89 | + |
| 90 | +Lines starting with '#' are considered comments. Invalid lines are silently |
| 91 | +ignored, unless a high enough verbosity level has been specified. |
| 92 | + |
| 93 | + |
| 94 | +3.4. Running |
| 95 | + |
| 96 | +Run `actkbd --help' to see the various command line options. actkbd is normally |
| 97 | +able to auto-detect your keyboard device, therefore you do not need to specify |
| 98 | +it. For the most common case - a daemon with the default configuration file in |
| 99 | +/etc - the following command should suffice: |
| 100 | + |
| 101 | +# actkbd -D -q |
| 102 | + |
| 103 | +Note that sending HUP to actkbd will cause it to reload the configuration file. |
| 104 | + |
| 105 | + |
| 106 | +4. Internals |
| 107 | + |
| 108 | +The most interesting/messy part of evkey is the code that keeps track of which |
| 109 | +keys are pressed each moment. It uses a bitmask with one bit for each available |
| 110 | +key. When press/repeat events are received, the corresponding bit is set and it |
| 111 | +becomes unset when a release event is received for that key. To match key events |
| 112 | +with the corresponding actions, each valid configuration file entry has its key |
| 113 | +field transformed to a bitmask. After that, whenever a new event is received, |
| 114 | +the status bitmask is matched against all configuration entry bitmasks and the |
| 115 | +first one to match (if any) is used and the corresponding command is executed. |
| 116 | + |
| 117 | +Please note that the platform specific code is contained in <platform>.c (.e.g. |
| 118 | +linux.c). This file implements a generic interface to keyboard events, hiding |
| 119 | +each system's intricacies from the rest of code. It is also the file that has |
| 120 | +to be written/ported to add support for a new platform. |
| 121 | + |
| 122 | +For any additional details the best documentation is probalby the source code |
| 123 | +itself. |
| 124 | + |
| 125 | + |
| 126 | +5. License |
| 127 | + |
| 128 | +actkbd is released under the GNU General Public License version 2. The full |
| 129 | +text of the GPL is in the COPYING file that should be included in the actkbd |
| 130 | +distribution. |
| 131 | + |
| 132 | + |
| 133 | +6. Authors |
| 134 | + |
| 135 | +Original author: |
| 136 | + Theodoros V. Kalamatianos < [email protected]> |
0 commit comments