8

When I was using Windows I have some times made a good use of WinSpy++ which allowed to point to a window or a control (a widget, a window element) to see details about it (including the values of the fields of the structure/class describing this particular instance), send window manager messages to it etc. One of usual trivial tasks I have been using it for was to copy text from a non-selectable widget (like a label, which does not allow to select and copy text from it the way a text field does). Is there an analogous tool I can use with GNU/Linux GUI applications?

3 Answers 3

9

You can't expect a 1:1 mapping here. I don't know WinSpy++, but it's likely that what it can do is spread over several different tools, some of its features simply don't make sense under X, and conversely the X tools have additional features that don't make sense under Windows.

The basic X11 distribution comes with a number of simple tools. The ones that are most likely to be relevant here are:

  • xclients to list the programs that have a connection to a display
  • xprop to display window properties
  • xwininfo to display technical information about a window (position, visuals, …)

There are also tools to manipulate X resources: appres, editres (for those few applications that implement it), listres, xrdb.

Two third-party utilities that are often useful to get information and act on windows are wmctrl (perform window manager actions from the command line) and xdotool (send events to a window).

7

Neither the window manager nor the X server know about widgets/controls, so there is no standard way that a tool could query the system for the details of another application's widgets. An application mostly sends the X server things like pixmaps, polygon drawing operations and text drawing operations.

However there are tools that can attach to a process and inspect its widget toolkit's data structures. For applications that use GTK+, there is Parasite. A fork of Parasite is now included in GTK+ since version 3.14.

For Qt, a quick search turns up Qt Inspector, inspired by KSpy, a tool hidden in the KDE repositories.

If you need to find out which widget toolkit an application uses, you can list the libraries on which it depends by using the command-line tool ldd.

4

Basically, not really.

To get information about a window, you can use the

xwininfo

command. However, unsurprisingly because X11 is different to Windows, it doesn't print the same information. I don't know of any way to copy text out of non-selectable controls, though perhaps these may be less common than they are under Windows.

As for sending window manager messages, I'm not sure about that. You might be able to use a tool based on the XRECORD extension, for example Xnee. However, I've never tried this.

1
  • for copy text out of non-selectable control/window, I guess it should be part of the accessibility (of program/toolkit). (but afaik, the standard on this is far from mature.)
    – yuyichao
    Feb 12, 2012 at 23:52

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .