System-wide system capture is a complex issue, but system-wide key capture is even more complex. Each OS / GUI has its own solution, at least for capture. Qt4 does not disclose such a function, but the Qt eXTension library solves the problem with its QxtGlobalShortcut . This is a good wrapper for:
This way you can capture an explicit key combination, i.e. a specific key and modifiers (XGrabKey () allows a little more) that no other application will receive. Key sequences, that is, sequential key combinations, are not supported here.
Keyboard capture is much more efficient because it allows you to look at input events (or even filter them). It is not only used by keyboard recorders, but is also a typical association.
If you are on Windows, you can read:
In X11, this is much more complicated. There are at least two pages that you can read:
There was an X event interception extension , but it was not supported and was ultimately removed.
Hope this can be done without the help of the X11 infrastructure. The Linux 2.6 kernel has an “Event Interface” known as evdev , which can be used here. Details can be found in the source code of the logkeys Linux keylogger . This can also be done with something similar to evdev. See My PoC project: kaos - Key Activity Screen.
And I don't have a Mac, so no further links .;)
source share