Listening to keyboard events without trapping them?

后端 未结 4 1752
别跟我提以往
别跟我提以往 2021-02-05 14:03

I\'m writing an command-line application which listens for Control key release events in X Windows and alerts another process when it detects them.

Being new to GNU/Linu

4条回答
  •  南方客
    南方客 (楼主)
    2021-02-05 14:15

    You need to use the XRecord extension. It can be used with pyxlib (pykeylogger mentioned in the other answer uses this), or by wrapping libX11 and libXtst via ctypes (as I did in synaptiks).

    Note however, that programming with xrecord (and to some degree also with XLib in general) is somehwat hard, because the API is badly documented, and quite baroque and counter-intuitive.

提交回复
热议问题