← 返回命令列表

Linux command

xprop 命令

文本

复制后可按需替换文件名、目录或参数。

常用示例

Click to select a window

xprop

Display properties of the root window

xprop -root

Display properties of a window by ID

xprop -id [0x200007]

Display properties of a window by name

xprop -name "[window_name]"

Display a specific property

xprop -root WM_NAME

Monitor property changes

xprop -spy -id [window_id]

Set a property

xprop -root -set [PROPERTY_NAME] "[value]"

Remove a property

xprop -root -remove [PROPERTY_NAME]

说明

xprop displays properties of X Window System windows. Properties are arbitrary data that applications and window managers use to communicate, such as window titles (WM_NAME), window classes (WM_CLASS), and window states. When invoked without -id, -name, or -root, xprop displays a crosshair cursor allowing interactive window selection by clicking. Specific properties can be listed as arguments to display only those. Common properties include WM_NAME (title), WM_CLASS (application class), WM_STATE, _NET_WM_PID, and various Extended Window Manager Hints (_NET_WM_*).

参数

-display _display_
Connect to the specified X server.
-id _id_
Query window by numeric ID (decimal or hex with 0x prefix).
-name _name_
Query window by its WM_NAME property (title).
-root
Display properties of the root window (desktop).
-frame
Select the window manager frame instead of the client window.
-len _n_
Limit output to the first n bytes per property.
-notype
Don't print property types, only names and values.
-spy
Monitor for property change events continuously.
-set _property_ _value_
Set a property on the window.
-remove _property_
Remove a property from the window.
-f _atom_ _format_ _dformat_
Specify format for interpreting a property.
-version
Print version and exit.

FAQ

What is the xprop command used for?

xprop displays properties of X Window System windows. Properties are arbitrary data that applications and window managers use to communicate, such as window titles (WM_NAME), window classes (WM_CLASS), and window states. When invoked without -id, -name, or -root, xprop displays a crosshair cursor allowing interactive window selection by clicking. Specific properties can be listed as arguments to display only those. Common properties include WM_NAME (title), WM_CLASS (application class), WM_STATE, _NET_WM_PID, and various Extended Window Manager Hints (_NET_WM_*).

How do I run a basic xprop example?

Run `xprop` in a terminal, then adjust file names, paths, flags, or remote targets for your system.

What does -display _display_ do in xprop?

Connect to the specified X server.