]> git.lizzy.rs Git - plan9front.git/blob - sys/man/4/rio
0ed8d96ebd53701a68609251076c2be2348a26fe
[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
205 integers, padded to 12 characters as described in
206 .IR image (6):
207 upper left
208 .I x
209 and
210 .IR y ,
211 lower right
212 .I x
213 and
214 .IR y .
215 Following these numbers are strings, also padded to 12 characters,
216 describing the window's state:
217 .B current
218 or
219 .BR notcurrent ;
220 .B hidden
221 or
222 .BR visible .
223 A subsequent read will block until the window changes size, location, or state.
224 When written to,
225 .B wctl
226 accepts messages to change the size or placement of the associated window,
227 and to create new windows.
228 The messages are in a command-line like format, with a command name,
229 possibly followed by options introduced by a minus sign.
230 The options must be separated by blanks, for example
231 .B -dx 100
232 rather than
233 .BR -dx100 .
234 .IP
235 The commands are
236 .B resize
237 (change the size and position of the window),
238 .B move
239 (move the window),
240 .B scroll
241 (enable scrolling in the window),
242 .B noscroll
243 (disable scrolling),
244 .B set
245 (change selected properties of the window),
246 .B top
247 (move the window to the `top', making it fully visible),
248 .B bottom
249 (move the window to the `bottom', perhaps partially or totally obscuring it),
250 .B hide
251 (hide the window),
252 .B unhide
253 (restore a hidden window),
254 .B current
255 (make the window the recipient of keyboard and mouse input),
256 .B delete
257 (close the window and terminate its associated processes)
258 and
259 .B new
260 (make a new window).
261 The
262 .B top
263 and
264 .B bottom
265 commands do not change whether the window is current or not.
266 Neither
267 .B top
268 nor
269 .B bottom
270 has any options.
271 .IP
272 The
273 .BR resize ,
274 .BR move ,
275 and
276 .B new
277 commands accept
278 .B -minx
279 .IR n ,
280 .B -miny
281 .IR n ,
282 .B -maxx
283 .IR n ,
284 and
285 .BR -maxy
286 .I n
287 options to set the position of the corresponding edge of the window.
288 They also accept an option
289 .B -r
290 .I minx miny maxx maxy
291 to set all four at once.
292 The
293 .B resize
294 and
295 .B new
296 commands accept
297 .B -dx
298 .I n
299 and
300 .B -dy
301 .I n
302 to set the width and height of the window.
303 By default,
304 .I rio
305 will choose a convenient geometry automatically.
306 .IP
307 Finally, the
308 .B new
309 command accepts an optional shell command and argument string,
310 given as plain strings after any standard options, to run in the window
311 instead of the default
312 .B rc
313 .B -i
314 (see
315 .IR rc (1)).
316 The
317 .B -pid
318 .I pid
319 option to
320 .B new
321 identifies the
322 .I pid
323 of the process whose `note group' should receive interrupt
324 and hangup notes generated in the window.
325 The initial working directory of the new window may be set by a
326 .B -cd
327 .I directory
328 option.
329 The
330 .B -hide
331 option causes the window to be created off-screen, in the hidden state, while
332 .B -scroll
333 and
334 .B -noscroll
335 set the initial scrolling state of the window; the default is that of the main program.
336 .IP
337 The
338 .B set
339 command accepts a set of parameters in the same style; only
340 .B -pid
341 .I pid
342 is implemented.
343 .IP
344 So programs outside name spaces controlled by
345 .I rio
346 may create windows,
347 .B wctl
348 .B new
349 messages may also be written to the named pipe identified by
350 .BR $wctl .
351 .TP
352 .B wdir
353 is a read/write text file containing
354 .IR rio 's
355 idea of the current working directory of the process running in the window.
356 It is used to fill in the
357 .B wdir
358 field of
359 .IR plumb (6)
360 messages
361 .I rio
362 generates from the
363 .B plumb
364 menu item on button 2.
365 The file is writable so the program may update it;
366 .I rio
367 is otherwise unaware of
368 .IR chdir (2)
369 calls its clients make.
370 In particular,
371 .IR rc (1)
372 maintains
373 .B /dev/wdir
374 in default
375 .IR rio (1)
376 windows.
377 .TP
378 .B winid
379 returns the unique and unchangeable ID for the window;
380 it is a string of digits.
381 .TP
382 .B window
383 is the virtual version of
384 .BR /dev/screen .
385 It contains the depth, coordinates, and
386 uncompressed raster image corresponding to the associated
387 window.
388 .TP
389 .B wsys
390 is a directory containing a subdirectory for each window, named
391 by the unique ID for that window.  Within each subdirectory
392 are entries corresponding to several of the special files associated
393 with that window:
394 .BR cons ,
395 .BR consctl ,
396 .BR label ,
397 .BR mouse ,
398 etc.
399 .SH EXAMPLES
400 Cause a window to be created in the upper left corner,
401 and the word
402 .L hi
403 to be printed there.
404 .IP
405 .EX
406 mount $wsys /tmp 'new -r 0 0 128 64 -pid '$pid
407 echo hi > /tmp/cons
408 .EE
409 .PP
410 Start
411 .IR sam (1)
412 in a large horizontal window.
413 .IP
414 .EX
415 echo new -dx 800 -dy 200 -cd /sys/src/cmd sam > /dev/wctl
416 .EE
417 .PP
418 Print the screen image of window with id 123.
419 .IP
420 .EX
421 lp /dev/wsys/123/window
422 .EE
423 .SH SOURCE
424 .B /sys/src/cmd/rio
425 .SH SEE ALSO
426 .IR rio (1),
427 .IR draw (3),
428 .IR mouse (3),
429 .IR kbdfs (8),
430 .IR event (2),
431 .IR graphics (2).