xwininfo
Display information about X Window System windows
TLDR
Display a cursor to select a window to display its attributes (id, name, size, position, ...)
Display the tree of all windows
Display the attributes of a window with a specific ID
Display the attributes of a window with a specific name
Display the ID of a window searching by name
SYNOPSIS
xwininfo [options]
PARAMETERS
-help
Displays a brief usage message and exits.
-id <id>
Specifies the window ID (hexadecimal or decimal) for which to display information. This bypasses interactive selection.
-name <name>
Specifies the window by its name (case-sensitive) for which to display information. Supports partial matching.
-root
Selects the root window of the display for information gathering. The root window is the desktop background.
-tree
Shows the selected window's parent and child windows in a hierarchical tree format, illustrating the window lineage.
-stats
Displays statistical information about the window's state, such as its map state (visible/hidden) and override redirect status.
-wm
Shows window manager hints and properties associated with the window, including properties like WM_HINTS and WM_CLASS.
-int
Forces all geometry output to be in integer format, avoiding floating-point numbers for position and size.
-all
A convenience option that combines -tree, -stats, and -wm to show comprehensive information about the window.
-frame
Includes the window manager's frame (decorations like title bar and borders) in geometry calculations and reported information.
-children
Lists only the immediate children of the specified window, without displaying other window information.
-metric
Displays window geometry dimensions in millimeters (mm) instead of the default pixels.
-english
Displays window geometry dimensions in pixels (the default behavior). Explicitly sets the unit to pixels.
-display <display>
Specifies the X server display to connect to (e.g., :0.0) if not using the default.
-pointer
Selects the window at the current pointer position without user interaction. This is often the default interactive behavior if no ID/name is given.
DESCRIPTION
xwininfo is a command-line utility designed to display comprehensive information about a specific window on an X Window System server. It is an indispensable tool for developers, system administrators, and power users who need to understand the characteristics and state of graphical windows.
When invoked without specific window identifiers, xwininfo enters an interactive mode, prompting the user to click on the desired window. Alternatively, users can specify a window by its unique ID (hexadecimal or decimal) or by its name. The output typically includes the window's ID, its parent and children, its absolute and relative geometry (position and size), border width, depth, class, name, and various X properties. This information is crucial for debugging X applications, scripting window management tasks, and gaining insight into the X server's window hierarchy.
CAVEATS
xwininfo requires a running X server to function. The 'window name' property it reports (WM_NAME) might not always correspond to the visible title bar text, as some applications use different properties or don't set WM_NAME. For complex applications or toolkits that manage numerous internal sub-windows, the output can be very verbose and potentially misleading without understanding the application's internal structure. Information gathered may be out of date if the window's state changes rapidly after the command is run.
INTERACTIVE USAGE
If xwininfo is invoked without any window identification options (like -id or -name), it enters an interactive mode. In this mode, the cursor changes, and the user is prompted to click on any window on the desktop. Upon clicking, xwininfo will display the information for the selected window. This is often the easiest way to inspect an unknown window.
SCRIPTING AND AUTOMATION
The output of xwininfo is highly structured and can be easily parsed using standard command-line tools like grep, awk, or sed. This makes it an invaluable component for shell scripts designed to automate window management tasks, such as repositioning windows, taking screenshots of specific applications, or identifying window IDs for further manipulation with tools like xdotool.
DEBUGGING X APPLICATIONS
For developers, xwininfo serves as a critical debugging tool. It helps in verifying a window's reported size, position, depth, and other properties, ensuring that an application's windows are created and managed as expected by the X server and window manager. It can reveal inconsistencies that might lead to display issues or unexpected behavior.
HISTORY
xwininfo is a fundamental utility that has been part of the X Window System's core distribution since its early days. It originated as part of the MIT X Consortium's X11 (X Window System, Version 11) utilities, which laid the groundwork for modern Unix-like graphical environments. Its development has continued under projects like XFree86 and currently X.Org, reflecting its ongoing importance in understanding and debugging X client-server interactions. Its design is rooted in the basic principles of the X Protocol, providing a direct interface to query window attributes.
SEE ALSO
xprop(1), xdpyinfo(1), xlsclients(1), xdotool(1)