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 [-help] [-int] [-display dpy] [-id id] [-root] [-name name] [-tree] [-stats] [-bits] [-events] [-size] [-font] [-wm] [-all]
PARAMETERS
-help
Print brief usage summary and exit.
-int
Display integer values (IDs, coordinates) in decimal, hexadecimal, and octal.
-display dpy
Connect to specified X display (e.g., :0).
-id id
Use specific hexadecimal window ID instead of picking.
-root
Target the screen's root window.
-name name
Select top-level window by exact resource name.
-tree
Show window ID tree from target window down.
-stats
Print window enter/leave event counts.
-bits
Show bit gravity, backing-store, and save-under flags.
-events
List subscribed event masks.
-size
Display normal and zoom size hints.
-font
Print font name hierarchy for window.
-wm
Show window manager hints.
-all
Print all available information categories.
DESCRIPTION
xwininfo is a utility from the X Window System toolkit that provides detailed information about windows managed by the X server. When invoked without specifying a window ID, it enters "pick" mode, allowing the user to click on any visible window to retrieve its properties. Output includes essential details such as the window ID, geometry (position and size), class, resource name, parent window, and more, depending on selected options.
It is invaluable for X11 developers, system administrators, and users debugging graphical applications. For instance, it reveals window manager hints, event masks, font hierarchies, and size constraints. By combining options like -tree or -all, users can explore the window hierarchy or get comprehensive data.
Typically used in X11 environments (not native to Wayland), it requires a valid $DISPLAY variable. Common use cases include scripting window manipulations, verifying window attributes in test suites, or identifying problematic windows causing display issues. The tool outputs human-readable text, making it suitable for parsing in shell scripts with tools like grep or awk.
CAVEATS
Does not work natively on Wayland; use XWayland if available. Pick mode captures only visible windows. Window names must match exactly with -name. Requires X11 permissions and $DISPLAY set.
USAGE EXAMPLES
Basic pick: xwininfo → Click window.
Root info: xwininfo -root
All details: xwininfo -id 0x123456 -all
Tree view: xwininfo -tree
HISTORY
Introduced in X Version 11 Release 4 (X11R4) around 1989 by the MIT X Consortium. Maintained in Xorg project since XFree86 fork; current versions in xorg-x11-utils package.


