A simple Linux / X11 program to capture and maintain keyboard focus?

I am writing a simple break / anti-RSI program in Linux (Ubuntu) in Python. I asked similar questions about locking the keypad ( How do I lock the keypad to prevent other keystrokes from being sent to X11 / Linux / Gnome? And Releasing all keys after disabling the keyboard in X11 / Linux using xinput? ) And someone suggested ( stack overflow). site / questions / 1414169 / ... ) to capture keyboard focus would be a better way. However, I am new to X11 programming. How do I do this in Python? (Suppose I have python-xlib or everything that was installed, I can also install something from pypi or apt).

How do you make a simple X11 application that will capture keyboard focus (even if another window is currently focused). The user should not have the possibility of alt-tab or alt-f4 (i.e. there is no way out). However, it should be possible to “release” this “scramble” later or at any time.

+1
source share

Source: https://habr.com/ru/post/1414982/


All Articles