How to get one program to access the widgets/controls of another program in linux using X11?
I can use XQueryTree()
with X11 to find all of the top level windows. However, as noted in my question here: Disable/enable control in X11/xlib , X11 does not provide a way to get the widgets/controls within those windows, which is what I need.
I then investigated Gtk (using GtkSharp which wraps Gtk 3). That purports to be able to get all top level windows known to Gtk using screen.ToplevelWindows
, however that clearly doesn’t work. I am running Linux Mint which uses Cinnamon which uses some flavor of Gtk under the hood. However, enumerating all toplevel windows using screen.ToplevelWindows
does NOT return any of the top level windows from the currently running programs in Cinnamon.
Cinnamon doesn’t publish an API to interact with it either, so I am unsure if this is even possible in Cinnamon.
Even if it did, that would only get me one window manager on one distro. KDE for example uses Qt for its widgets/controls. And even if that worked, I am working in C# and don’t know of a current, well maintained C# wrapper for Qt.
Even that would only get us two. There are no doubt countless other window managers and systems out there.
So my question is: is there any common/well established way for one program in linux/X11 to find all top level windows on the system, then drill down into all child windows/widgets and manipulate them?
Context: I am trying to write a cross platform implementation of the famous AutoHotkey Windows desktop automation program in C#, which allows a script to manipulate any window on the system.