
Greetings.
In this part of a series of articles on xneur, I want to talk about programs for GNU / Linux that are directly or indirectly related to switching layouts, intercepting keyboard events, recording or keystroke logging, as well as scripts that perform xneur-like functions.
It will be a question of those programs which I know, tried, and from which took those or other ideas of work with xlib and keyboard interception in linux.
')
By themselves, these programs do not have a direct relationship to xneur, but if you want to do something like xneur, then for general development you should familiarize yourself with them and their code (only if you lose the xneur source code).
Forerunner
xev
It is a utility from the x11-utils package. It is intended to show the message queue X server.
At startup, it displays its window and displays all X server messages destined for that window. In other matters, it can show X server messages for other windows by their ID. It does not intercept the keyboard as such; it simply shows a copy of the message queue.
xdotool, xvkbd
Programs for sending keystrokes, text, or mouse clicks to applications. Both programs use the XTEST X11 protocol extension to one degree or another.
xdootool lives here
www.semicomplete.com/projects/xdotool . The program generally allows a lot: to simulate keyboard input, mouse (clicks and movement), movement, resizing, hiding or showing windows, etc. I recommend this program for scripting.
Analogs
sven
This program (
http://sven.linux.kiev.ua/ ), which died at the dawn of xneur, allows you to configure additional keys on the multimedia keyboard. These are such keys as: “WWW”, “E-mail”, volume control buttons, CD-ROM control, etc. Moreover, even if you use a regular keyboard, you can use Sven to emulate multimedia keys using keyboard shortcuts, for example : Ctrl + w - launch a web browser, etc. To enable the text conversion feature, you need to enable the Autoconvert module. I note that for this module, the program uses early xneur developments (early and bad heuristic algorithms).
I can say only one thing about this program, it’s a pity that it no longer develops, I hoped that xneur would have a competitor. Competition generally stimulates development.
bash script text conversion
Available here
habrahabr.ru/blogs/shells/120502. How it works and what's inside of it - it is written by reference. The disadvantages of this script are, firstly, the complete dependence on a particular layout - for non-qwerty layouts, the script must be redone. Secondly, the script performs only the conversion of the selected text, and that's it.
Keyloggers
lkl
In my opinion, the oldest keylogger for linux. Sourceforge.net/projects/lkl nests here.
When working, it uses standard interrupts, it requires root rights. It has not been developed for a long time and is removed from the Ubuntu repositories.
logkeys
In some way the successor to lkl. Sources can be found here
code.google.com/p/logkeys . In the package descriptions for Ubuntu, they write about it: “Logkeys is similar to many other available programs for recording user-pressed keys, but it is more up-to-date, eliminates repeated key presses and does not cause graphics system X crashes. It relies on Linux input subsystem events. Once installed, it records all keystroke and function key presses, also considering the state of the Ctrl and AltGr modifier keys. ”
I tried, really writes, but the log is all in Latin, does not translate the text into other layouts at all. Well, I am also confused by the fact that this program must explicitly indicate from which device in / dev / input to catch events. In general, to use it as a keylogger, you need to be sure that the machine it is running on will not change. And so, I plugged the usb-keyboard into another port, and goodbye.
xnee
Program to record and play back user actions for X11.
When I tried it, it had a critical incompatibility with Xlib, the program crashed right away. But the program package includes a lot of things - a console interface, a graphical interface, and even an applet for the Gnome2 panel. But it did not work for me, alas.
Summarizing
Programs and utilities for working with the keyboard in linux mass. And each utility does its job perfectly. But when trying to combine the functionality of various utilities for such a simple action as “intercept key — handle a press — if necessary, transfer a click back or not transmit”, the carousel begins. If we add the need to follow not one application, but many, the problems grow even more. Well, to everything else, add here the zoo of graphic tulkits - there is a general trash here. Needless to say that there are still a huge number of linux distributions with their zoo versions of libraries?
After a couple of years of working on xneur, I’m not surprised at the lack of common viruses for linux - here the devil will break his leg. That's why xneur sometimes works weird. And this is in most cases not a problem of my crooked hands.
Previous parts of the series
X Neural Switcher - Cookbook (Part 0).
The following parts of the series
X Neural Switcher - Cookbook (Part 2). Algorithms.