LinuxCommandLibrary

xwininfo

Display information about X Window System windows

TLDR

Display a cursor to select a window to display its attributes (id, name, size, position, ...)

$ xwininfo
copy

Display the tree of all windows
$ xwininfo -tree -root
copy

Display the attributes of a window with a specific ID
$ xwininfo -id [id]
copy

Display the attributes of a window with a specific name
$ xwininfo -name [name]
copy

Display the ID of a window searching by name
$ xwininfo -tree -root | grep [keyword] | head -1 | perl -ne 'print $1 if /(0x[\da-f]+)/ig;'
copy

SYNOPSIS

xwininfo [-options]

PARAMETERS

-help
    Print out the flag settings supported by xwininfo.

-id windowid
    Specifies the window ID to use.

-name window_name
    Specifies the window name to use.

-root
    Select the root window.

-shape
    Display shape information.

-stats
    Display window statistics (size, position, etc.).

-tree
    Display the window tree hierarchy.

-all
    Display all available information about the window.

-int
    Print all values as integers.

-hex
    Print all values as hexadecimal.

-metric
    Print all sizes in metric units.

-english
    Print sizes in English units (e.g., inches).

-bw
    Display the border width.

-nobw
    Do not display the border width.

-geometry
    Display the geometry of the window.

-add_depth
    Include the depth of the window in the output.

-display display_name
    Specifies the X display to use.

DESCRIPTION

The xwininfo command is a utility for displaying information about windows running under the X Window System. It allows users to select a window, either by clicking on it or specifying its ID, and then outputs a comprehensive set of details about that window. These details include the window's size, position, border width, parent window, children windows, background color, map state, event mask, and more. xwininfo is a valuable tool for developers debugging X11 applications, system administrators troubleshooting display issues, and anyone who needs detailed insight into the X window hierarchy. It's particularly useful for understanding how different applications interact with the window manager and the underlying X server.

The information provided by xwininfo can be crucial for diagnosing problems related to window geometry, event handling, and resource allocation within the X environment. The utility relies on querying the X server for window properties, and displays the results in a human-readable format.

CAVEATS

xwininfo relies on the X server for information. If the server is unavailable or misconfigured, the command may fail or provide inaccurate results.
Some information, such as window properties set by applications, might not always be readily available or easily interpretable.

SELECTION

When no window ID or name is provided, xwininfo prompts the user to select a window by clicking on it.
The crosshair cursor indicates that the program is waiting for a window selection.

INTERPRETING OUTPUT

The output of xwininfo can be extensive. Pay close attention to the window ID, geometry (size and position), and parent/children windows to understand the window hierarchy. The event mask indicates which events the window is listening for.

HISTORY

xwininfo has been a standard utility in the X Window System for a long time. It was developed to provide a way to introspect the state of X windows, a capability useful for developers and system administrators. While the exact origins are not widely documented, it is likely part of the early MIT X Consortium efforts.

SEE ALSO

xprop(1), xdotool(1), xdpyinfo(1)

Copied to clipboard