]> git.lizzy.rs Git - plan9front.git/blob - sys/man/4/rio
pc: add $ operator
[plan9front.git] / sys / man / 4 / rio
1 .TH RIO 4
2 .SH NAME
3 rio \- window system files
4 .SH SYNOPSIS
5 .B rio
6 [
7 .B -i
8 .BI ' cmd '
9 ]
10 [
11 .B -k
12 .BI ' kbdcmd '
13 ]
14 [
15 .B -s
16 ]
17 [
18 .B -b
19 ]
20 [
21 .B -f
22 .I font
23 ]
24 .SH DESCRIPTION
25 The window system
26 .I rio
27 serves a variety of files for reading, writing, and controlling
28 windows.
29 Some of them are virtual versions of system files for dealing
30 with the display, keyboard, and mouse; others control operations
31 of the window system itself.
32 .I Rio
33 posts its service in the
34 .B /srv
35 directory, using a
36 name constructed from a catenation of the user ID
37 and a process id; the environment variable
38 .BR $wsys
39 is set to this service name within processes running under the control
40 of each invocation of
41 .IR rio .
42 Similarly,
43 .I rio
44 posts a named pipe to access the window creation features
45 (see
46 .B window
47 in
48 .IR rio (1))
49 from outside
50 its name space; this is named in
51 .BR $wctl .
52 .PP
53 A
54 .I mount
55 (see
56 .IR bind (1))
57 of
58 .B $wsys
59 causes
60 .I rio
61 to create a new window; the attach specifier in the
62 .I mount
63 gives the coordinates of the created window.
64 The syntax of the specifier is the same as the arguments to
65 .B window
66 (see
67 .IR rio (1)).
68 By default, the window is sized and placed automatically.
69 It is always necessary, however, to provide the process id of the
70 process to whom to deliver notes generated by DEL characters and hangups
71 in that window.
72 That pid is specified by including the string
73 .B -pid
74 .I pid
75 in the attach specifier.  (See the Examples section
76 .IR q.v. )
77 .PP
78 When a window is created either by
79 the
80 .I window
81 command
82 (see
83 .IR rio (1))
84 or by using the menu supplied by
85 .IR rio ,
86 this server is mounted on
87 .BR /mnt/wsys
88 and also
89 .BR /dev ;
90 the files mentioned here
91 appear in both those directories.
92 .PP
93 Some of these files supply virtual versions of services available from the underlying
94 environment, in particular the character terminal files
95 .B cons
96 and
97 .B kbd
98 (see
99 .IR kbdfs (8)),
100 and the mouse files
101 .IR mouse (3)
102 and
103 .IR cursor ,
104 each specific to the window.
105 Note that the
106 .IR draw (3)
107 device multiplexes itself;
108 .IR rio
109 places windows but does not mediate programs' access to the display device.
110 .PP
111 Other files are unique to
112 .IR rio .
113 .TF window
114 .TP
115 .B cons
116 a virtual version of the standard terminal file from
117 .IR kbdfs (8).
118 .I Rio
119 supplies extra editing features and a scroll bar
120 (see
121 .IR rio (1)).
122 .TP
123 .B consctl
124 controls interpretation of console input.
125 Writing strings to it sets these modes:
126 .B rawon
127 turns on raw mode;
128 .B rawoff
129 turns off raw mode;
130 .B holdon
131 turns on hold mode;
132 .B holdoff
133 turns off hold mode.
134 Closing the file makes the window revert to default state
135 (raw off, hold off).
136 .TP
137 .B kbd
138 represents the raw keyboard events (see
139 .IR kbdfs (8))
140 for the corresponding window. While open,
141 navigation keys and input on the
142 .IR cons
143 file is disabled.
144 .TP
145 .B cursor
146 Like
147 .B mouse
148 .RI ( q.v. ),
149 a multiplexed version of the underlying device file, in this case representing the
150 appearance of the mouse cursor when the mouse is within the corresponding window.
151 .TP
152 .B label
153 initially contains a string with the process ID of the lead process
154 in the window and the command being executed there.
155 It may be written and is used as a tag when the window is hidden.
156 .TP
157 .B mouse
158 is a virtual version of the standard mouse file (see
159 .IR mouse (3)).
160 Opening it turns off scrolling, editing, and
161 .IR rio -supplied
162 menus in the associated
163 window.
164 In a standard mouse message, the first character is
165 .BR m ,
166 but
167 .I rio
168 will send an otherwise normal message with the first character
169 .B r
170 if the corresponding window has been resized.
171 The application must then call
172 .B getwindow
173 (see
174 .IR graphics (2))
175 to re-establish its state in the newly moved or changed window.
176 Reading the
177 .B mouse
178 file blocks until the mouse moves or a button changes.
179 Mouse movements or button changes are invisible when the mouse cursor
180 is located outside the window, except that if the mouse leaves the window
181 while a button is pressed, it will continue receiving mouse data until the button is released.
182 .TP
183 .B screen
184 is a read-only file reporting the depth, coordinates, and raster image corresponding to the entire
185 underlying display,
186 in the uncompressed format defined in
187 .IR image (6).
188 .TP
189 .B snarf
190 returns the string currently in the snarf buffer.
191 Writing this file sets the contents of the snarf buffer.
192 When
193 .I rio
194 is run recursively, the inner instance uses the snarf buffer of the parent, rather than
195 managing its own.
196 .TP
197 .B text
198 returns the full contents of the window.
199 Write appends to the window. Truncating
200 clears the windows contents.
201 .TP
202 .B wctl
203 may be read or written.
204 When read, it returns the location of the window as four decimal integers formatted
205 in the usual 12-character style: upper left
206 .I x
207 and
208 .IR y ,
209 lower right
210 .I x
211 and
212 .IR y .
213 Following these numbers are strings describing the window's state:
214 .B hidden
215 or
216 .BR visible ;
217 .B current
218 or
219 .BR notcurrent .
220 A subsequent read will block until the window changes size, location, or state.
221 When written to,
222 .B wctl
223 accepts messages to change the size or placement of the associated window,
224 and to create new windows.
225 The messages are in a command-line like format, with a command name,
226 possibly followed by options introduced by a minus sign.
227 The options must be separated by blanks, for example
228 .B -dx 100
229 rather than
230 .BR -dx100 .
231 .IP
232 The commands are
233 .B resize
234 (change the size and position of the window),
235 .B move
236 (move the window),
237 .B scroll
238 (enable scrolling in the window),
239 .B noscroll
240 (disable scrolling),
241 .B set
242 (change selected properties of the window),
243 .B top
244 (move the window to the `top', making it fully visible),
245 .B bottom
246 (move the window to the `bottom', perhaps partially or totally obscuring it),
247 .B hide
248 (hide the window),
249 .B unhide
250 (restore a hidden window),
251 .B current
252 (make the window the recipient of keyboard and mouse input),
253 .B delete
254 (close the window and terminate its associated processes)
255 and
256 .B new
257 (make a new window).
258 The
259 .B top
260 and
261 .B bottom
262 commands do not change whether the window is current or not.
263 Neither
264 .B top
265 nor
266 .B bottom
267 has any options.
268 .IP
269 The
270 .BR resize ,
271 .BR move ,
272 and
273 .B new
274 commands accept
275 .B -minx
276 .IR n ,
277 .B -miny
278 .IR n ,
279 .B -maxx
280 .IR n ,
281 and
282 .BR -maxy
283 .I n
284 options to set the position of the corresponding edge of the window.
285 They also accept an option
286 .B -r
287 .I minx miny maxx maxy
288 to set all four at once.
289 The
290 .B resize
291 and
292 .B new
293 commands accept
294 .B -dx
295 .I n
296 and
297 .B -dy
298 .I n
299 to set the width and height of the window.
300 By default,
301 .I rio
302 will choose a convenient geometry automatically.
303 .IP
304 Finally, the
305 .B new
306 command accepts an optional shell command and argument string,
307 given as plain strings after any standard options, to run in the window
308 instead of the default
309 .B rc
310 .B -i
311 (see
312 .IR rc (1)).
313 The
314 .B -pid
315 .I pid
316 option to
317 .B new
318 identifies the
319 .I pid
320 of the process whose `note group' should receive interrupt
321 and hangup notes generated in the window.
322 The initial working directory of the new window may be set by a
323 .B -cd
324 .I directory
325 option.
326 The
327 .B -hide
328 option causes the window to be created off-screen, in the hidden state, while
329 .B -scroll
330 and
331 .B -noscroll
332 set the initial scrolling state of the window; the default is that of the main program.
333 .IP
334 The
335 .B set
336 command accepts a set of parameters in the same style; only
337 .B -pid
338 .I pid
339 is implemented.
340 .IP
341 So programs outside name spaces controlled by
342 .I rio
343 may create windows,
344 .B wctl
345 .B new
346 messages may also be written to the named pipe identified by
347 .BR $wctl .
348 .TP
349 .B wdir
350 is a read/write text file containing
351 .IR rio 's
352 idea of the current working directory of the process running in the window.
353 It is used to fill in the
354 .B wdir
355 field of
356 .IR plumb (6)
357 messages
358 .I rio
359 generates from the
360 .B plumb
361 menu item on button 2.
362 The file is writable so the program may update it;
363 .I rio
364 is otherwise unaware of
365 .IR chdir (2)
366 calls its clients make.
367 In particular,
368 .IR rc (1)
369 maintains
370 .B /dev/wdir
371 in default
372 .IR rio (1)
373 windows.
374 .TP
375 .B winid
376 returns the unique and unchangeable ID for the window;
377 it is a string of digits.
378 .TP
379 .B window
380 is the virtual version of
381 .BR /dev/screen .
382 It contains the depth, coordinates, and
383 uncompressed raster image corresponding to the associated
384 window.
385 .TP
386 .B wsys
387 is a directory containing a subdirectory for each window, named
388 by the unique ID for that window.  Within each subdirectory
389 are entries corresponding to several of the special files associated
390 with that window:
391 .BR cons ,
392 .BR consctl ,
393 .BR label ,
394 .BR mouse ,
395 etc.
396 .SH EXAMPLES
397 Cause a window to be created in the upper left corner,
398 and the word
399 .L hi
400 to be printed there.
401 .IP
402 .EX
403 mount $wsys /tmp 'new -r 0 0 128 64 -pid '$pid
404 echo hi > /tmp/cons
405 .EE
406 .PP
407 Start
408 .IR sam (1)
409 in a large horizontal window.
410 .IP
411 .EX
412 echo new -dx 800 -dy 200 -cd /sys/src/cmd sam > /dev/wctl
413 .EE
414 .PP
415 Print the screen image of window with id 123.
416 .IP
417 .EX
418 lp /dev/wsys/123/window
419 .EE
420 .SH SOURCE
421 .B /sys/src/cmd/rio
422 .SH SEE ALSO
423 .IR rio (1),
424 .IR draw (3),
425 .IR mouse (3),
426 .IR kbdfs (8),
427 .IR event (2),
428 .IR graphics (2).