Release 1.6.0.
[xtoys] / xatom.1
CommitLineData
01a2fe8e
MW
1.\" -*-nroff-*-
2.TH xatom 1 "13 September 2007" "Straylight/Edgeware" "xtoys"
3.SH NAME
4xatom \- manipulate properties on X windows
5.SH SYNOPSIS
6.B xatom
7.RB [ \- d
8.IR display ]
9.RB [ \- w
10.IR window ]
11.I command
12.PP
13where
14.I command
15is one of:
16.PP
17.B help
18.RI [ command ...]
19.br
20.B get
21.I property
22.br
23.B set
24.I property
25.I value
26.br
27.B delete
28.I property
29.br
30.B wait
31.I property
32.RI [ value ...]
33.SH DESCRIPTION
34The
35.B xatom
36program manipulates properties of a simple kind on X windows. It deals
37only with those properties whose value is a single X atom. It is
38capable of setting, reading, and deleting properties, and also waiting
39until a particular property is set, maybe to one of a number of given
40values.
41.PP
42The program provides a number of subcommands, by which the various
43operations may be carried out.
44.SS "Global options"
45Before the command name,
46.I "global options"
47may be given. The following global options are supported.
48.TP
49.BR "\-h, \-\-help " [\fIcommand\fP...]
50Writes a brief summary of
51.BR xatom 's
52various operations to standard output, and returns a successful exit
53status. With command names, gives help on those commands.
54.TP
55.B "\-v, \-\-version"
56Writes the program's version number to standard output, and returns a
57successful exit status.
58.TP
59.B "\-u, \-\-usage"
60Writes a very terse command line summary to standard output, and returns
61a successful exit status.
62.TP
63.BI "\-d, \-\-display=" display
64Connect to the X server named by
65.I display
66rather than the default, which is to consult the
67.B DISPLAY
68environment variable.
69.TP
70.BI "\-w, \-\-window=" window
71Manipulate properties on the window whose ID is
72.I window
73rather than the default, which is to use the root window of the screen
74named by
75.IR display .
76If
77.I window
78is the string
79.B choose
80then the window can be chosen interactively: the
81.B xatom
82program will grab the pointer and wait for a button-1 click over a
83window. A button-3 click causes
84.B xatom
85to quit (and return an unsuccessful exit status).
86.SH "COMMAND REFERENCE"
87.SS "help"
88The
89.B help
90command behaves exactly as the
91.B \-\-help
92option. With no arguments, it shows an overview of
93.BR xatom 's
94options; with arguments, it described the named subcommands.
95.SS "get"
96The
97.B get
98command retrieves the named
99.I property
100from the specified window, and reports its value on standard output.
101.PP
102If the property wasn't found, or its value wasn't a single atom, nothing
103is written, but a successful exit status is still returned. If a value
104was found, it is written and followed by a newline: therefore a client
105can distinguish an empty value from no value at all.
106.SS "set"
107The
108.B set
109command sets the named
110.I property
111to have the specified
112.IR value ,
113overwriting any existing value.
114.SS "delete"
115The
116.B delete
117command removes the named
118.I property
119from the window. If no such property exists, nothing happens.
120.SS "wait"
121The
122.B wait
123command waits on a particular
124.IR property .
125If any
126.IR value s
127are specified, then the command waits until the property's value matches
128one of the specified
129.IR value s:
130if it already matches one of them then the command won't wait.
131If no
132.IR value s
133are specified, then the command waits until the property is set to any
134value; again, if it is already set, the command returns immediately.
135.PP
136If exactly one
137.I value
138is given, the command produces no output; otherwise, it writes the new
139value of the property, as for the
140.B get
141command.
142.SH EXAMPLE
143The author uses this command at the end of his
144.BR .xinitrc
145file, to control the duration of his X session. Specifically, he uses
146the code
147.PP
148.RS
149.ft B
150.nf
151xatom set MDW_SHUTDOWN READY
152xatom wait MDW_SHUTDOWN SHUTDOWN
153xatom delete MDW_SHUTDOWN
154.fi
155.RE
156The script
157.B xshutdown
158looks like this.
159.PP
160.RS
161.ft B
162.nf
163#! /bin/sh
164set -e
165me=$(basename $0)
166case "$(xatom get MDW_SHUTDOWN)" in
167 READY) ;;
168 *) xmsg -e -t $me "Nobody's waiting for my signal."; exit 1;;
169esac
170case "$(xmsg -q -t $me \
171 "Really shut down this session?" :_Shutdown \~gtk-cancel)" in
172 _Shutdown)
173 xatom set MDW_SHUTDOWN SHUTDOWN
174 ;;
175esac
176.fi
177.RE
178.SH BUGS
179None currently known.
180.SH SEE ALSO
181.BR xmsg (1),
182.BR XChangeProperty (3x),
183.BR XGetWindowProperty (3x),
184.BR XDeleteProperty (3x).
185.SH AUTHOR
186Mark Wooding (mdw@distorted.org.uk).