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?
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:
Basically, not really.
To get information about a window, you can use the
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.
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