Key Scripter
AboutInstallationSetupUsageCreating scriptsDownloads

Setup

Note: this chapter is for Linux users only. Windows users can skip it and go directly to Usage.

In order to listen to key events, Key Scripter reads raw data from one or more device files. You can use the following command to determine which device corresponds to your keyboard, mouse or keypad:

cat /proc/bus/input/devices

Key Scripter allows you to specify the value of the listed 'N: Name' or 'P: Phys' property instead of the actual device file name. However, it is easy to determine which device file to use by looking at the 'H: Handlers' property. For example, 'H: Handlers=kbd event2' means that you can specify /dev/input/event2 as the source file for Key Scripter:

key-scripter -i=/dev/input/event2

Because device files are dynamically created, they are not guaranteed to stay the same after a system reboot. Therefore, when starting Key Scripter from a script, it may be better to specify the input device by its name (using the value from the 'N: Name' property), instead of specifying the actual device file. Key Scripter will then automatically determine which device file it must use in order to read from the device. For example, the following line instructs Key Scripter to read from two devices with the specified names:

key-scripter -in="AT Set 2 keyboard" -in="PS/2 Logitech Mouse"

You should also be aware that normally only root can read /dev/input/event* files. This means that Key Scripter won't work if run by a regular user. You can avoid running Key Scripter as root by changing access permissions of the device file. Of course, you also need to make sure that you don't make your device file accessible to anyone.

One way to do that is to use the 'input' group, which is created during installation of Key Scripter. The install script also adds the key-scripter executable to the 'input' group and enables the 'set group ID on execution' file mode on it. All that is left for you to do after installing Key Scripter is to execute the following line, which will enable anyone in the 'input' group to read device files:

chown :input /dev/input/event* && chmod g+r /dev/input/event*

Of course, since device files are recreated each time the system is rebooted, you need to perform the above step on each system start-up. The easiest way to do that is to add the above line to one of your system start-up scripts.