]> git.lizzy.rs Git - plan9front.git/blob - sys/man/1/rio
dd(1): update manpage to match program
[plan9front.git] / sys / man / 1 / rio
1 .TH RIO 1
2 .SH NAME
3 rio, label, window, wloc \- window system
4 .SH SYNOPSIS
5 .B rio
6 [
7 .BI "-i '"cmd '
8 ]
9 [
10 .BI "-k '"kbdcmd '
11 ]
12 [
13 .B -s
14 ]
15 [
16 .B -b
17 ]
18 [
19 .B -f
20 .I font
21 ]
22 .PP
23 .B label
24 .I name
25 .PP
26 .B window
27 [
28 .B -m
29 ] [
30 .B -r
31 .I minx miny maxx maxy
32 ] [
33 .B -dx
34 .I n
35 ] [
36 .B -dy
37 .I n
38 ] [
39 .B -minx
40 .I n
41 ] [
42 .B -miny
43 .I n
44 ] [
45 .B -maxx
46 .I n
47 ] [
48 .B -maxy
49 .I n
50 ] [
51 .B -cd
52 .I dir
53 ] [
54 .B -hide
55 ] [
56 .B -scroll
57 ] [
58 .B -noscroll
59 ] [
60 .I cmd
61 .I arg ...
62 ]
63 .PP
64 .B wloc
65 .SH DESCRIPTION
66 .I Rio
67 manages asynchronous layers of text, or windows, on a raster display.
68 It also serves a variety of files for communicating with
69 and controlling windows; these are discussed in section
70 .IR rio (4).
71 .SS Commands
72 The
73 .I rio
74 command starts a new instance of the window system.
75 Its
76 .B -i
77 option names a startup script, which typically contains several
78 .I window
79 commands generated by
80 .IR wloc .
81 The
82 .B -k
83 option causes
84 .I rio
85 to run the command
86 .I kbdcmd
87 at startup and allow it to provide characters as keyboard input; the
88 .B keyboard
89 program described in
90 .IR bitsyload (1)
91 is the usual choice.
92 .PP
93 The
94 .B -s
95 option initializes windows so that text scrolls;
96 the default is not to scroll.
97 The
98 .B -b
99 option reverses the normal color scheme for windows, painting white
100 text on a black background.
101 The
102 .I font
103 argument names a font used to display text, both in
104 .IR rio 's
105 menus
106 and as a default for any programs running in its windows; it also
107 establishes the
108 environment variable
109 .BR $font .
110 If
111 .B -f
112 is not given,
113 .I rio
114 uses the imported value of
115 .BR $font
116 if set; otherwise it imports the default font from the underlying graphics
117 server, usually the terminal's operating system.
118 .PP
119 The
120 .I label
121 command changes a window's identifying name.
122 .PP
123 The
124 .I window
125 command creates a window.
126 By default, it creates a shell window and sizes and places it automatically.
127 The geometry arguments control the size
128 .IB ( dx ,
129 .BR dy )
130 and placement
131 .RB ( minx ,
132 .BR miny ,
133 .BR maxx ,
134 .BR maxy );
135 the units are pixels with the
136 upper left corner of the screen at (0, 0).
137 The
138 .B hide
139 option causes the window to be created off-screen.
140 The
141 .B scroll
142 and
143 .B noscroll
144 options set the scroll mode.
145 The
146 .B cd
147 option sets the working directory.
148 The optional command and arguments 
149 define which program to run in the window.
150 .PP
151 By default,
152 .I window
153 uses
154 .B /dev/wctl
155 (see
156 .IR rio (4))
157 to create the window and run the command.  Therefore, the window and command
158 will be created by
159 .I rio
160 and run in a new file name space, just as if the window had been created using the interactive menu.
161 However, the
162 .B -m
163 option uses the file server properties of
164 .I rio
165 to
166 .B mount
167 (see
168 .IR bind (1))
169 the new window's name space within the name space of the program calling
170 .IR window .
171 This means, for example, that running
172 .B window
173 in a CPU window will create another window whose command runs on the terminal, where
174 .I rio
175 is running; while
176 .B window
177 .B -m
178 will create another window whose command runs on the CPU server.
179 .PP
180 The
181 .I wloc
182 command prints the coordinates and label of each window in its instance of
183 .I rio
184 and is used to construct arguments for
185 .IR window .
186 .SS Window control
187 Each window behaves as a separate terminal with at least one process
188 associated with it.
189 When a window is created, a new process (usually a shell; see
190 .IR rc (1))
191 is established and bound to the window as a new process group.
192 Initially, each window acts as a simple terminal that displays character text;
193 the standard input and output of its processes
194 are attached to
195 .BR /dev/cons .
196 Other special files, accessible to the processes running in a window,
197 may be used to make the window a more general display.
198 Some of these are mentioned here; the complete set is
199 discussed in
200 .IR rio (4).
201 .PP
202 One window is
203 .IR current ,
204 and is indicated with a dark border and text;
205 characters typed on the keyboard are available in the
206 .B /dev/cons
207 file of the process in the current window.
208 Characters written on
209 .B /dev/cons
210 appear asynchronously in the associated window whether or not the window
211 is current.
212 .PP
213 Windows are created, deleted and rearranged using the mouse.
214 Clicking (pressing and releasing) mouse button 1 in a non-current
215 window makes that window current and brings it in front of
216 any windows that happen to be overlapping it.
217 When the mouse cursor points to the background area or is in
218 a window that has not claimed the mouse for its own use,
219 pressing mouse button 3 activates a
220 menu of window operations provided by
221 .IR rio .
222 Releasing button 3 then selects an operation.
223 At this point, a gunsight or cross cursor indicates that
224 an operation is pending.
225 The button 3 menu operations are:
226 .TF Resize
227 .TP
228 .B New
229 Create a window.
230 Press button 3 where one corner of the new rectangle should
231 appear (cross cursor), and move the mouse, while holding down button 3, to the
232 diagonally opposite corner.
233 Releasing button 3 creates the window, and makes it current.
234 Very small windows may not be created.
235 .TP
236 .B Resize
237 Change the size and location of a window.
238 First click button 3 in the window to be changed
239 (gunsight cursor).
240 Then sweep out a window as for the
241 .B New
242 operation.
243 The window is made current.
244 .TP
245 .B Move
246 Move a window to another location.
247 After pressing and holding button 3 over the window to be moved (gunsight cursor),
248 indicate the new position by dragging the rectangle to the new location.
249 The window is made current.
250 Windows may be moved partially off-screen.
251 .TP
252 .B Delete
253 Delete a window.  Click in the window to be deleted (gunsight cursor).
254 Deleting a window causes a
255 .L hangup
256 note to be sent to all processes in the window's process group
257 (see
258 .IR notify (2)).
259 .TP
260 .B Hide
261 Hide a window.  Click in the window to be hidden (gunsight cursor);
262 it will be moved off-screen.
263 Each hidden window is given a menu entry in the button 3 menu according to the
264 value of the file
265 .BR /dev/label ,
266 which
267 .I rio
268 maintains
269 (see
270 .IR rio (4)).
271 .TP
272 .I label
273 Restore a hidden window.
274 .PD
275 .PP
276 Windows may also be arranged by dragging their borders.
277 Pressing button 1 or 2 over a window's border allows one to
278 move the corresponding edge or corner, while button 3
279 moves the whole window.
280 .PD
281 .SS Text windows
282 Characters typed on the keyboard or written to
283 .B /dev/cons
284 collect in the window to form
285 a long, continuous document.
286 .PP
287 There is always some
288 .I selected
289 .IR text ,
290 a contiguous string marked on the screen by reversing its color.
291 If the selected text is a null string, it is indicated by a hairline cursor
292 between two characters.
293 The selected text
294 may be edited by mousing and typing.
295 Text is selected by pointing and clicking button 1
296 to make a null-string selection, or by pointing,
297 then sweeping with button 1 pressed.
298 Text may also be selected by double-clicking:
299 just inside a matched delimiter-pair
300 with one of
301 .B {[(<«`'"
302 on the left and
303 .B }])>»`'"
304 on the right, it selects all text within
305 the pair; at the beginning
306 or end of a line, it selects the line; within or at the edge of an alphanumeric word,
307 it selects the word.
308 .PP
309 Characters typed on the keyboard replace the selected text;
310 if this text is not empty, it is placed in a
311 .I snarf buffer
312 common to all windows but distinct from that of
313 .IR sam (1).
314 .PP
315 Programs access the text in the window at a single point
316 maintained automatically by
317 .IR rio .
318 The
319 .I output point
320 is the location in the text where the next character written by
321 a program to
322 .B /dev/cons
323 will appear; afterwards, the output point is the null string
324 beyond the new character.
325 The output point is also the location in the text of the next character
326 that will be read (directly from the text in the window,
327 not from an intervening buffer)
328 by a program from
329 .BR /dev/cons .
330 When such a read will occur is, however, under control of
331 .I rio
332 and the user.
333 .PP
334 In general there is text in the window after the output point,
335 usually placed there by typing but occasionally by the editing
336 operations described below.
337 A pending read of
338 .B /dev/cons
339 will block until the text after the output point contains
340 a newline, whereupon the read may
341 acquire the text, up to and including the newline.
342 After the read, as described above, the output point will be at
343 the beginning of the next line of text.
344 In normal circumstances, therefore, typed text is delivered
345 to programs a line at a time.
346 Changes made by typing or editing before the text is read will not
347 be seen by the program reading it.
348 If the program in the window does not read the terminal,
349 for example if it is a long-running computation, there may
350 accumulate multiple lines of text after the output point;
351 changes made to all this text will be seen when the text
352 is eventually read.
353 This means, for example, that one may edit out newlines in
354 unread text to forestall the associated text being read when
355 the program finishes computing.
356 This behavior is very different from most systems.
357 .PP
358 Even when there are newlines in the output text,
359 .I rio
360 will not honor reads if the window is in
361 .I hold
362 .IR mode ,
363 which is indicated by a white cursor and blue text and border.
364 The ESC character toggles hold mode.
365 Some programs, such as
366 .IR mail (1),
367 automatically turn on hold mode to simplify the editing of multi-line text;
368 type ESC when done to allow
369 .I mail
370 to read the text.
371 .PP
372 An EOT character (control-D) behaves exactly like newline except
373 that it is not delivered to a program when read.
374 Thus on an empty line an EOT serves to deliver an end-of-file indication:
375 the read will return zero characters.
376 Like newlines, unread EOTs may be successfully edited out of the text.
377 The BS character (control-H) erases the character before the selected text.
378 The ETB character (control-W) erases any nonalphanumeric characters, then
379 the alphanumeric word just before the selected text.
380 `Alphanumeric' here means non-blanks and non-punctuation.
381 The NAK character (control-U) erases the text after the output point,
382 and not yet read by a program, but not more than one line.
383 All these characters are typed on the keyboard and hence replace
384 the selected text; for example, typing a BS with a word selected
385 places the word in the snarf buffer, removes it from the screen,
386 and erases the character before the word.
387 .PP
388 An ACK character (control-F) or Insert character triggers file name completion
389 for the preceding string (see
390 .IR complete (2)).
391 .PP
392 Typing a left or right arrow moves the cursor one character in that direction.
393 Typing an SOH character (control-A) moves the cursor to the beginning of the
394 current line; an ENQ character (control-E) moves to the end. The STX character
395 (control-B) moves the cursor to the output point.
396 .PP
397 Text may be moved vertically within the window.
398 A scroll bar on the left of the window shows in its clear portion what fragment of the
399 total output text is visible on the screen, and in its gray part what
400 is above or below view;
401 it measures characters, not lines.
402 Mousing inside the scroll bar moves text:
403 clicking button 1 with the mouse pointing inside the scroll bar
404 brings the line at the top of the
405 window to the cursor's vertical location;
406 button 3 takes the line at the cursor to the top of the window;
407 button 2, treating the scroll bar as a ruler, jumps to the indicated portion
408 of the stored text.
409 Holding a button pressed in the scroll bar will cause the text
410 to scroll continuously until the button is released.
411 Also, a page down
412 or down-arrow
413 scrolls forward
414 half a window, and page up or up-arrow scrolls back.
415 Typing the home key scrolls to the top of the window; typing the end key scrolls
416 to the bottom.
417 .PP
418 The DEL character sends an
419 .L interrupt
420 note to all processes in the window's process group.
421 Unlike the other characters, the DEL, VIEW, and up- and down-arrow
422 keys do not affect the selected text.
423 The left (right) arrow key moves the selection to one character
424 before (after) the current selection.
425 .PP
426 Normally, written output to a window blocks when
427 the text reaches the end of the screen;
428 a button 2 menu item toggles scrolling.
429 .PP
430 Other editing operations are selected from a menu on button 2.
431 The
432 .B cut
433 operation deletes the selected text
434 from the screen and puts it in the snarf buffer;
435 .B snarf
436 copies the selected text to the buffer without deleting it;
437 .B paste
438 replaces the selected text with the contents of the buffer;
439 and
440 .B send
441 copies the snarf buffer to just after the output point, adding a final newline
442 if missing.
443 .B Paste
444 will sometimes and
445 .B send
446 will always place text after the output point; the text so placed
447 will behave exactly as described above.  Therefore when pasting
448 text containing newlines after the output point, it may be prudent
449 to turn on hold mode first.
450 .PP
451 The
452 .B plumb
453 menu item sends the contents of the selection (not the snarf buffer) to the
454 .IR plumber (4).
455 If the selection is empty, it sends the white-space-delimited text
456 containing the selection (typing cursor).
457 A typical use of this feature is to tell the editor to find the source of an error
458 by plumbing the file and line information in a compiler's diagnostic.
459 .SS Raw text windows
460 Opening or manipulating certain files served by
461 .IR rio
462 suppresses some of the services supplied to ordinary text windows.
463 While the file
464 .B /dev/mouse
465 is open, any mouse operations are the responsibility of another program
466 running in the window.  Thus,
467 .I rio
468 refrains from maintaining
469 the scroll bar,
470 supplying text editing or menus, interpreting the
471 VIEW key as a request to scroll, and also turns scrolling on.
472 .PP
473 The file
474 .B /dev/consctl
475 controls interpretation of keyboard input.
476 In particular, a raw mode may be set:
477 in a raw-input window, no typed keyboard characters are special,
478 they are not echoed to the screen, and all are passed
479 to a program immediately upon reading, instead of being gathered into
480 lines.
481 .SS Graphics windows
482 A program that holds
483 .B /dev/mouse
484 and
485 .B /dev/consctl
486 open after putting the console in raw mode
487 has complete control of the window:
488 it interprets all mouse events, gets all keyboard characters,
489 and determines what appears on the screen.
490 .SH FILES
491 .TF /srv/riowctl.\fIuser\fP.\fIpid\fP
492 .TP
493 .B /lib/font/bit/*
494 font directories
495 .TP
496 .B /mnt/wsys
497 Files served by
498 .I rio
499 (also unioned in
500 .B /dev
501 in a window's name space, before the terminal's real
502 .B /dev
503 files)
504 .TP
505 .B /srv/rio.\fIuser\fP.\fIpid\fP
506 Server end of
507 .IR rio .
508 .TP
509 .B /srv/riowctl.\fIuser\fP.\fIpid\fP
510 Named pipe for
511 .I wctl
512 messages.
513 .SH SOURCE
514 .TF /sys/src/cmd/rio
515 .TP
516 .B /sys/src/cmd/rio
517 .TP
518 .B /rc/bin/label
519 .TP
520 .B /rc/bin/window
521 .TP
522 .B /rc/bin/wloc
523 .SH "SEE ALSO"
524 .IR rio (4),
525 .IR rc (1),
526 .IR cpu (1),
527 .IR sam (1),
528 .IR mail (1),
529 .IR proof (1),
530 .IR graphics (2),
531 .IR frame (2),
532 .IR window (2),
533 .IR notify (2),
534 .IR cons (3),
535 .IR draw (3),
536 .IR mouse (3),
537 .IR keyboard (6)
538 .SH BUGS
539 The standard input of
540 .I window
541 is redirected to the newly created window, so there is no way to pipe the output
542 of a program to the standard input of the new window.
543 In some cases,
544 .IR plumb (1)
545 can be used to work around this limitation.