views:

599

answers:

1

Hey,

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.

+3  A: 

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

ypnos