0

I am currently trying to get into writing something like an autoclicker. I work on a openSUSE Leap with KDE environment and program in c++ or FORTRAN or python.

In order to do so I need access to whatever interface there is between the gui and the computer.

I first was inclined to use Xlib and Xutil which are apparently libraries that give access to the I/O functions of the GUI, but they don't come preinstalled with this system.

Now first I thought about installing them, but then I thought I would rather like to know what makes them, what is that invisible layer between my c++ code and the rest of the computer.

I am really out of my depths here, which is why my question might be formulated in an obscure way, but I thought, maybe I try and change that.

Would appreciate recommendations.

Cheers.

8
  • 1
    Start by reading about the XTest library/extension, which allows you to generate clicks, keypresses and other input events just as if they came from a real keyboard or mouse. There's the xdotool program which is using it, and despite being buggy, awkward and limited, can be used for simple "autoclick" tasks. Or, at a lower level, the uinput Linux module. Creating a robust expect-like framework for instrumenting GUIs would be a lot of work, though.
    – user313992
    Commented Nov 2, 2021 at 13:07
  • Hey, thanks for the suggestion. I pasted together a testcode fur uinput usage from uinput and epitron/uinput-sample.c which results in ``error: open: Permission denied". I reckon I'm doing something wrong as any new USB is mounted without the necessity of root privileges. Commented Nov 2, 2021 at 15:06
  • No, you cannot use uinput without root privileges. But any client with full access to an X11 display can use XTest (full access means local client or ssh + ForwardX11Trusted).
    – user313992
    Commented Nov 2, 2021 at 17:08
  • 1
    ldd ... | grep libXtst.
    – user313992
    Commented Nov 2, 2021 at 21:46
  • 1
    No, the XTest library doesn't make use of uinput or other kernel functions, and doesn't escalate the privileges of the program which is using it. That library is a (very simple) wrapper which allows one to use the XTEST extension of the X11 server, which in turn works by creating a virtual mouse and keyboard accessible only to the X11 server (xinput will show you those virtual devices). The problem with XTest is that it only works with X11 applications, not with native wayland applications.
    – user313992
    Commented Nov 5, 2021 at 11:13

0

You must log in to answer this question.

Browse other questions tagged .