]> git.lizzy.rs Git - plan9front.git/blob - sys/man/1/rio
paint(1): english
[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 sheme 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.
395 .PP
396 Text may be moved vertically within the window.
397 A scroll bar on the left of the window shows in its clear portion what fragment of the
398 total output text is visible on the screen, and in its gray part what
399 is above or below view;
400 it measures characters, not lines.
401 Mousing inside the scroll bar moves text:
402 clicking button 1 with the mouse pointing inside the scroll bar
403 brings the line at the top of the
404 window to the cursor's vertical location;
405 button 3 takes the line at the cursor to the top of the window;
406 button 2, treating the scroll bar as a ruler, jumps to the indicated portion
407 of the stored text.
408 Holding a button pressed in the scroll bar will cause the text
409 to scroll continuously until the button is released.
410 Also, a page down
411 or down-arrow
412 scrolls forward
413 half a window, and page up or up-arrow scrolls back.
414 Typing the home key scrolls to the top of the window; typing the end key scrolls
415 to the bottom.
416 .PP
417 The DEL character sends an
418 .L interrupt
419 note to all processes in the window's process group.
420 Unlike the other characters, the DEL, VIEW, and up- and down-arrow
421 keys do not affect the selected text.
422 The left (right) arrow key moves the selection to one character
423 before (after) the current selection.
424 .PP
425 Normally, written output to a window blocks when
426 the text reaches the end of the screen;
427 a button 2 menu item toggles scrolling.
428 .PP
429 Other editing operations are selected from a menu on button 2.
430 The
431 .B cut
432 operation deletes the selected text
433 from the screen and puts it in the snarf buffer;
434 .B snarf
435 copies the selected text to the buffer without deleting it;
436 .B paste
437 replaces the selected text with the contents of the buffer;
438 and
439 .B send
440 copies the snarf buffer to just after the output point, adding a final newline
441 if missing.
442 .B Paste
443 will sometimes and
444 .B send
445 will always place text after the output point; the text so placed
446 will behave exactly as described above.  Therefore when pasting
447 text containing newlines after the output point, it may be prudent
448 to turn on hold mode first.
449 .PP
450 The
451 .B plumb
452 menu item sends the contents of the selection (not the snarf buffer) to the
453 .IR plumber (4).
454 If the selection is empty, it sends the white-space-delimited text
455 containing the selection (typing cursor).
456 A typical use of this feature is to tell the editor to find the source of an error
457 by plumbing the file and line information in a compiler's diagnostic.
458 .SS Raw text windows
459 Opening or manipulating certain files served by
460 .IR rio
461 suppresses some of the services supplied to ordinary text windows.
462 While the file
463 .B /dev/mouse
464 is open, any mouse operations are the responsibility of another program
465 running in the window.  Thus,
466 .I rio
467 refrains from maintaining
468 the scroll bar,
469 supplying text editing or menus, interpreting the
470 VIEW key as a request to scroll, and also turns scrolling on.
471 .PP
472 The file
473 .B /dev/consctl
474 controls interpretation of keyboard input.
475 In particular, a raw mode may be set:
476 in a raw-input window, no typed keyboard characters are special,
477 they are not echoed to the screen, and all are passed
478 to a program immediately upon reading, instead of being gathered into
479 lines.
480 .SS Graphics windows
481 A program that holds
482 .B /dev/mouse
483 and
484 .B /dev/consctl
485 open after putting the console in raw mode
486 has complete control of the window:
487 it interprets all mouse events, gets all keyboard characters,
488 and determines what appears on the screen.
489 .SH FILES
490 .TF /srv/riowctl.\fIuser\fP.\fIpid\fP
491 .TP
492 .B /lib/font/bit/*
493 font directories
494 .TP
495 .B /mnt/wsys
496 Files served by
497 .I rio
498 (also unioned in
499 .B /dev
500 in a window's name space, before the terminal's real
501 .B /dev
502 files)
503 .TP
504 .B /srv/rio.\fIuser\fP.\fIpid\fP
505 Server end of
506 .IR rio .
507 .TP
508 .B /srv/riowctl.\fIuser\fP.\fIpid\fP
509 Named pipe for
510 .I wctl
511 messages.
512 .SH SOURCE
513 .TF /sys/src/cmd/rio
514 .TP
515 .B /sys/src/cmd/rio
516 .TP
517 .B /rc/bin/label
518 .TP
519 .B /rc/bin/window
520 .TP
521 .B /rc/bin/wloc
522 .SH "SEE ALSO"
523 .IR rio (4),
524 .IR rc (1),
525 .IR cpu (1),
526 .IR sam (1),
527 .IR mail (1),
528 .IR proof (1),
529 .IR graphics (2),
530 .IR frame (2),
531 .IR window (2),
532 .IR notify (2),
533 .IR cons (3),
534 .IR draw (3),
535 .IR mouse (3),
536 .IR keyboard (6)
537 .SH BUGS
538 The standard input of
539 .I window
540 is redirected to the newly created window, so there is no way to pipe the output
541 of a program to the standard input of the new window.
542 In some cases,
543 .IR plumb (1)
544 can be used to work around this limitation.