xprop
Display window properties
TLDR
Display the name of the root window
Display the window manager hints for a window
Display the point size of a font
Display all the properties of the window with the ID 0x200007
SYNOPSIS
xprop [-options] [format [atom] ...]
PARAMETERS
-display display
Specifies the X server to connect to.
-id id
Specifies the window to query by its numeric ID. If not specified, xprop prompts for a window selection by mouse click.
-name name
Specifies the window to query by its WM_NAME property. This is useful for finding windows by their title.
-font fontname
Specifies a font to be used when looking up windows by name. This is rarely needed.
-root
Specifies that properties of the root window should be displayed. The root window is the desktop background and manages global X server properties.
-len N
Limits the output for each property to the first N bytes. This is useful for very large properties.
-notype
Prevents xprop from printing the type of the property. Only the atom name and data will be shown.
-noucs
Prevents xprop from attempting to print UCS (Unicode) characters, only Latin-1. Useful for older terminals or character issues.
-f format atom
Specifies a custom format for printing a specific atom property. This allows for fine-grained control over how multi-valued properties are displayed. Can be used multiple times.
-spy
Prints properties of new windows as they are created. This runs continuously, monitoring for new window events.
-version
Prints the program version and exits.
DESCRIPTION
xprop is a command-line utility used to display the properties of an X Window System window. Properties are arbitrary pieces of data associated with a window, which X applications and window managers use to communicate information, such as the window's title (WM_NAME), its class (WM_CLASS), or its current state.
When invoked, xprop can either prompt the user to select a window by clicking on it, or it can operate on a window specified by its ID, name, or the root window. It then retrieves and prints all properties associated with that window by default, or specific properties if requested. The output includes the property's atom name, its type (e.g., STRING, ATOM, CARDINAL), and its format (8-bit, 16-bit, or 32-bit values), followed by the property's actual data. This tool is invaluable for debugging X applications, understanding how window managers interact with windows, and for scripting purposes to query window states.
CAVEATS
Understanding the output of xprop requires familiarity with X Window System concepts like atoms, property types, and data formats. Property names are case-sensitive. The command requires a running X server and appropriate display permissions. When selecting a window by clicking, rapidly moving or disappearing windows can be difficult to target.
INTERACTIVE MODE
If no specific window is identified using -id, -name, or -root, xprop enters an interactive mode. In this mode, the cursor changes to a crosshair, prompting the user to click on any visible window on the screen. Upon clicking, xprop will then display the properties of the selected window and exit, unless -spy is used.
PROPERTY TYPES AND FORMATS
The output of xprop typically includes the property's atom name, followed by its type and format. The type (e.g., STRING, ATOM, CARDINAL) indicates the kind of data stored. The format specifies the size of each data element in bits (8, 16, or 32). For example, WM_NAME(STRING) = "My Window Title" indicates a property named WM_NAME, of type STRING, containing the specified text. Understanding these distinctions is crucial for correctly interpreting the property values.
HISTORY
xprop is a long-standing utility within the X Window System's suite of diagnostic tools. It has been part of the standard X distribution for many decades, serving as a fundamental component for developers and system administrators to inspect and understand the state of X windows and their interactions. Its core functionality has remained largely consistent, reflecting the stable nature of the X protocol's property mechanisms. It is currently maintained as part of the Xorg project's x11-utils package.