Question

I'm wondering, is it possible to somehow map a key-press event to act like a middle-key click of a mouse in Xwindows? They are diffrent devices, I know, but if there was a way to trigger a middle-button click event from a C program, it should be easy to bind a key to it using existing xwindows mechanisms.

Was it helpful?

Solution

Xevent does the trick:

The code compiles and runs just fine on my machine.

If you are interested as a developer: It uses the XTest extension, which is included in the X server. There is also some old, still valid documentation of that API online: http://www.xfree86.org/current/xtestlib.html

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top