rio – window system files
The window system
serves a variety of files for reading, writing, and controlling
Some of them are virtual versions of system files for dealing
with the display, keyboard, and mouse; others control operations
of the window system itself.
posts its service in the
directory, using a
name constructed from a catenation of the user ID
and a process id; the environment variable
is set to this service name within processes running under the control
of each invocation of
posts a named pipe to access the window creation features
its name space; this is named in
to create a new window; the attach specifier in the
gives the coordinates of the created window.
The syntax of the specifier is the same as the arguments to
By default, the window is sized and placed automatically.
It is always necessary, however, to provide the process id of the
process to whom to deliver notes generated by DEL characters and hangups
in that window.
That pid is specified by including the string
in the attach specifier. (See the Examples section
When a window is created either by
or by using the menu supplied by
this server is mounted on
the files mentioned here
appear in both those directories.
Some of these files supply virtual versions of services available from the underlying
environment, in particular the character terminal files
and the mouse files
each specific to the window.
Note that the
device multiplexes itself;
places windows but does not mediate programs’ access to the display device.
Other files are unique to
a virtual version of the standard terminal file from
supplies extra editing features and a scroll bar
controls interpretation of console input.
Writing strings to it sets these modes:
turns on raw mode;
turns off raw mode;
turns on hold mode;
turns off hold mode.
Closing the file makes the window revert to default state
(raw off, hold off).
represents the raw keyboard events (see
for the corresponding window. While open,
navigation keys and input on the
file is disabled.
a multiplexed version of the underlying device file, in this case representing the
appearance of the mouse cursor when the mouse is within the corresponding window.
initially contains a string with the process ID of the lead process
in the window and the command being executed there.
It may be written and is used as a tag when the window is hidden.
is a virtual version of the standard mouse file (see
Opening it turns off scrolling, editing, and
menus in the associated
In a standard mouse message, the first character is
will send an otherwise normal message with the first character
if the corresponding window has been resized.
The application must then call
to re-establish its state in the newly moved or changed window.
file blocks until the mouse moves or a button changes.
Mouse movements or button changes are invisible when the mouse cursor
is located outside the window, except that if the mouse leaves the window
while a button is pressed, it will continue receiving mouse data until the button is released.
is a read-only file reporting the depth, coordinates, and raster image corresponding to the entire
in the uncompressed format defined in
returns the string currently in the snarf buffer.
Writing this file sets the contents of the snarf buffer.
is run recursively, the inner instance uses the snarf buffer of the parent, rather than
managing its own.
returns the full contents of the window.
Write appends to the window. Truncating
clears the windows contents.
may be read or written.
When read, it returns the location of the window as four decimal
integers, padded to 12 characters as described in
Following these numbers are strings, also padded to 12 characters,
describing the window’s state:
A subsequent read will block until the window changes size, location, or state.
When written to,
accepts messages to change the size or placement of the associated window,
and to create new windows.
The messages are in a command-line like format, with a command name,
possibly followed by options introduced by a minus sign.
The options must be separated by blanks, for example
The commands are
(change the size and position of the window),
(move the window),
(enable scrolling in the window),
(change selected properties of the window),
(move the window to the ‘top’, making it fully visible),
(move the window to the ‘bottom’, perhaps partially or totally obscuring it),
(hide the window),
(restore a hidden window),
(make the window the recipient of keyboard and mouse input),
(close the window and terminate its associated processes)
(make a new window).
commands do not change whether the window is current or not.
has any options.
options to set the position of the corresponding edge of the window.
They also accept an option
minx miny maxx maxy
to set all four at once.
to set the width and height of the window.
will choose a convenient geometry automatically.
command accepts an optional shell command and argument string,
given as plain strings after any standard options, to run in the window
instead of the default
of the process whose ‘note group’ should receive interrupt
and hangup notes generated in the window.
The initial working directory of the new window may be set by a
option causes the window to be created off-screen, in the hidden state, while
set the initial scrolling state of the window; the default is that of the main program.
command accepts a set of parameters in the same style; only
So programs outside name spaces controlled by
may create windows,
messages may also be written to the named pipe identified by
is a read/write text file containing
idea of the current working directory of the process running in the window.
It is used to fill in the
generates from the
menu item on button 2.
The file is writable so the program may update it;
is otherwise unaware of
calls its clients make.
returns the unique and unchangeable ID for the window;
it is a string of digits.
is the virtual version of
It contains the depth, coordinates, and
uncompressed raster image corresponding to the associated
is a directory containing a subdirectory for each window, named
by the unique ID for that window. Within each subdirectory
are entries corresponding to several of the special files associated
with that window:
Cause a window to be created in the upper left corner,
and the word
to be printed there.
mount $wsys /tmp 'new -r 0 0 128 64 -pid '$pid
echo hi > /tmp/cons
in a large horizontal window.
echo new -dx 800 -dy 200 -cd /sys/src/cmd sam > /dev/wctl
Print the screen image of window with id 123.