xprop(X) X Version 11 (11 July 1990) xprop(X)
NAME
xprop - property displayer for X
SYNOPSIS
xprop [-options ...] [property]
DESCRIPTION
The xprop utility displays both window and font properties
in an X server. You select one window or font using the
command-line arguments or by clicking on the desired window.
The xprop utility prints each property's value on the
selected window or font using the formatting information you
supply. If you supply no formatting information, xprop uses
its internal defaults. If you do not define a property on
the selected window or font, the message "not defined"
prints as the value for that property. If you specify no
property list, xprop prints all the properties possessed by
the selected window or font.
OPTIONS
-help
Prints out a summary of command-line options.
-grammar
Prints out a detailed grammar for all command-line
options.
-id id
Selects window id on the command line. You can specify
id in either either decimal or hex (must start with
0x). This option is very useful in debugging X
applications where the target window is not mapped to
the screen or when you cannot use the mouse because it
might interfere with the application.
-name name
Specifies that the window named name is the target
window on the command line rather than using the mouse
to select the target window.
-font font
Displays the the properties of font.
-root
Specifies the root window as the target window. This
is useful in situations when the root window is
completely obscured.
-display display
Specifies the server; see X(X).
Page 1 (printed 7/3/90)
xprop(X) X Version 11 (11 July 1990) xprop(X)
-len n
Specifies that at most n bytes of any property should
be read or displayed. This is useful if you're
displaying the cut buffer on the root window, which
could run to several pages if displayed in full.
-notype
Does not display each property type.
-fs file
Specifies that file should be used as a source of more
formats for properties.
-remove property-name
Specifies the name of a property to be removed from the
indicated window.
-f name format [dformat]
Specifies that the format for name should be format and
that the dformat for name should be dformat. If
dformat is missing, " = $0+\n" is assumed.
PROPERTY FORMATS EXPLAINED
The xprop utility displays each property name by printing
first the property name then its type (if it has one) in
parentheses followed by its value.
The formatting information for a property actually consists
of two parts, a format and a dformat. The format specifies
the actual formatting of the property (i.e., is it made up
of words, bytes, or longs, etc.?), while the dformat
specifies how the property should be displayed.
The following paragraphs describe how to construct formats
and dformats. However, for the vast majority of users and
uses, this should not be necessary as the built-in defaults
contain the formats and dformats necessary to display all
the standard properties. It should only be necessary to
specify formats and dformats if a new property is being
dealt with or you dislike the standard display format. New
users should probably skip this part.
A format consists of 0, 8, 16, or 32 followed by a sequence
of one or more format characters. The 0, 8, 16, or 32
specifies how many bits per field there are in the property.
0 is a special case that means use the field size
information associated with the property itself. (This is
only needed for special cases like type INTEGER, which is
actually three different types depending on the size of the
fields of the property.)
A value of 8 means that the property contains a sequence of
Page 2 (printed 7/3/90)
xprop(X) X Version 11 (11 July 1990) xprop(X)
bytes while a value of 16 means that the property contains a
sequence of words. It is possible for the server to be
running on a machine with a different byte order than the
machine on which xprop is running. If the two machines have
a different byte order, words have to by byte-swapped. For
more information on how properties are formatted and stored,
consult the Xlib manual.
Once the size of the fields has been specified, it is
necessary to specify the type of each field (i.e., is it an
integer, a string, an atom, etc.?). Use one format
character per field. If there are more fields in the
property than format characters supplied, the last character
is repeated as many times as necessary for the extra fields.
The format characters and their meanings follows:
a The field holds an atom number. A field of this type
should be size 32.
b The field is a boolean. A 0 means false; anything else
means true.
c The field is an unsigned cardinal number.
i The field is a signed integer.
m The field is a set of bit flags, 1 meaning on.
s This field and the next ones represent a sequence of
bytes until either a 0 or the end of the property. You
can only use this format character with a field size of
8. In its most common use, s represents a string.
x The field is a hex number (like c but displayed in
hex--most useful for displaying window IDs and the
like)
An example format is 32ica which is the format for a
property of three fields of 32 bits each, the first holding
a signed integer, the second an unsigned integer, and the
third an atom.
The dformat is not so rigid. The only limitations on a
dformat is that it cannot start with a letter or a dash.
This is so it can be distingished from a property name or an
argument. A dformat is a text string containing special
characters instructing that various fields be printed at
various points in a manner similar to the formatting string
used by printf. For example, the dformat " is ( $0, $1
\)\n" would render the POINT 3, -4 which has a format of
32ii as " is ( 3, -4 )\n".
Page 3 (printed 7/3/90)
xprop(X) X Version 11 (11 July 1990) xprop(X)
Any character other than a $, ?, \, or a ( in a dformat
prints as itself. To print out one of $, ?, \, or ( preceed
it by a \. For example, to print out a $, use \$. Several
special backslash sequences are provided as shortcuts. \n
displays a new line while \t displays a tab. \o where o is
an octal number will display character number o.
A $ followed by a number n displays field number n. The
format of the displayed field depends on the formatting
character used to describe it in the corresponding format.
If a cardinal is described by c it prints in decimal; if it
is described by an x it is displayed in hex.
If the field is not present in the property (this is
possible with some properties), <field not available> is
displayed instead. $n+ displays:
n,n+1, n+2. . .
until the last field is defined. If field n is not defined,
nothing is displayed. This is useful for a property that is
a list of values.
A ? starts a conditional expression, a kind of if-then
statement. ?exp(text) displays text if and only if exp
evaluates to nonzero. This is useful for two things.
First, it allows fields to be displayed if and only if a
flag is set. Second, it allows a value such as a state
number to be displayed as a name rather than as just a
number. The syntax of exp is as follows:
exp ::= term | term=exp | !exp
term ::= n | $n | mn
The ! operator is a logical "not," changing 0 to 1 and any
nonzero value to 0. "=" is an equality operator. Note that
internally all expressions are evaluated as 32-bit numbers
so -1 is not equal to 65535. "=" returns 1 if the two
values are equal and returns 0 if they are not. n
represents the constant value n while $n represents the
value of field number n. mn is 1 if flag number n in the
first field having format character "m" in the corrsponding
format is 1; otherwise mn is 0.
Examples:
To display field 3 with a label of count if and only if flag
number 3 (count starts at 0!) is on:
?m3(count: $3\n)
Page 4 (printed 7/3/90)
xprop(X) X Version 11 (11 July 1990) xprop(X)
To display the inverted value of field 2 as a boolean:
?$2=0(True)?!$2=0(False)
In order to display a property, xprop needs both a format
and a dformat. Before xprop uses its default values of a
format of 32x and a dformat of " = { $0+ }\n", it searches
several places in an attempt to find more specific formats.
First, it searches using the name of the property. If this
fails, it searches using the type of the property. This
allows type STRING to be defined with one set of formats
while allowing property WM_NAME, which is of type STRING, to
be defined with a different format. In this way, the
display formats for a given type can be overridden for
specific properties.
The xprop program searches the locations in the following
order: the format if any, specified with the property name
(as in 8x WM_NAME), the formats defined by -f options in
last-to-first order, the contents of the file specified by
the -fs option, if any, the contents of the file specified
by the environmental variable XPROPFORMATS, if any, and
finally xprop's built-in file of formats.
The format of the files referred to by the -fs argument and
the XPROPFORMATS variable is one or more lines of the
following form:
name format [dformat]
Where name is either the name of a property or the name of a
type, format is the format to be used with name and dformat is
the dformat to be used with name. If dformat is not present, "
= $0+\n" is assumed.
EXAMPLES
To display the name of the root window:
xprop -root WM_NAME
To display the window manager hints for the clock:
xprop -name xclock WM_HINTS
To display the start of the cut buffer:
xprop -root -len 100 CUT_BUFFER0
To display the point size of the fixed font:
xprop -font fixed POINT_SIZE
Page 5 (printed 7/3/90)
xprop(X) X Version 11 (11 July 1990) xprop(X)
To display all the properties of window # 0x200007:
xprop -id 0x200007
ENVIRONMENT
DISPLAY
Gets default display.
XPROPFORMATS
Specifies the name of a file containing additional
formats.
SEE ALSO
X(X)
xwininfo(X)
COPYRIGHT
Copyright 1988, Massachusetts Institute of Technology.
See X(X) for a full statement of rights and permissions.
AUTHOR
Mark Lillibridge, MIT Project Athena.
Page 6 (printed 7/3/90)