Contents

Riox - a modified version of the rio window manager

Introduction

Riox is a modified version of the Plan 9 window manager, rio.

The added features include :-

Riox can be run from within an individual window, or on the root window, by simply editing your profile file so that riox is run at startup, rather than rio. In the former case, you can pass the -x option to riox, to provide an “Exit” menu option.

Mouse bindings

By default, riox uses an alternative set of mouse bindings and menu configurations, which are intended to be more in line with usage on contemporary user interfaces :-

The conventional rio bindings can be used by starting riox with the -c option. However, this means some features are not available, namely the “Close”, “Keep above” and “Keep below” menu items, and the middle button text append feature.

Command line history and editing

Attributed text

Windows can display attributed text. The attributes are set by detecting standard CSI set-attribute escape sequences (ESC followed by a ‘[’, then a parameter number, and an ‘m’). The following numbers are recognized :-

Here is a replacement for ls, called just l, which uses colours to show directories and executable files.

Download l.c

Unlike ls, this program does its own column formatting, and can also list directories recursively. A useful rc function to use with it is :-

fn ll { l -l $* }

Fonts

Bold, italic and bold/italic fonts can be configured by setting the fontb, fonti and fontbi environment variables respectively. Otherwise, bold font defaults to the regular font, italic to bold and bold/italic to italic.

The following settings give quite good results :-

font=/lib/font/bit/pelm/euro.8.font
fontb=/lib/font/bit/fixed/unicode.8x13B.font
fonti=/lib/font/bit/fixed/unicode.8x13O.font

Test file

Here is a simple text file which tests colours and fonts. With the above font settings it gives the following output.

Window commands

The following additional commands can be written to a window’s wctl file.

Parameters

riox provides some additional parameters which can be used with the new and set window commands, and also with the attach parameter to mount.

Window files

The following extra files are available in the window directory.

hist

This file contains a listing of the command line history. The following rc function is useful :-

fn hist { cat $wdir/hist }

wdir

This read-only file reports the current directory of the process with the pid set with the -pid option when the window was created, or riox’s current directory if no -pid was specified. It does this by reading the /proc directory.

This file is present in rio, but as a simple read-write file. rio relies on rc setting its value, by writing to /dev/wdir each time a cd is run - see its simple.c source file. The problem with this is that /dev/wdir isn’t always the right file to write to (for example in a window running rc, but sharing the namespace of another window). Also an interactive sub-shell won’t reset wdir when it exits. And finally, if you’re using /bin/sh, it won’t keep wdir in synch at all.

The value of wdir is potentially useful for distinguishing different shell windows, and is used internally for the ^F file completion facility in text windows.

screeninfo

This file contains six integers. The first two give the mouse position, the next two give the location of the top left of the image riox is running in, and the final two give the location of the bottom right of the image.

logctl

This is a write-only file which controls a simple logging facility. Writing open <filename> truncates or creates the given file, and thereafter writes to it everything that is read from or written to the cons file. Logging is finished by writing close. The result should be a transcript of the session.

Note that, since the log file is opened by riox, the filename is resolved relative to riox’s working directory and namespace.

Here is a script file which uses the log facility to emulate the unix script program :-

Download script

#!/bin/rc
rfork e
d=`{date}
if (~ $1 -d) {
   echo 'Script done on '^$"d
   echo -n close >$wdir/logctl
}
if not {
   if (~ $#* 0) f=typescript
   if not f=$1
   # Make f an absolute filename
   if (! ~ $f /*) f=`{pwd}^/$f
   echo Opening log file $f
   if (echo -n 'open '^$f >$wdir/logctl)
      echo 'Script started on '^$"d
}

Use script with an optional filename (the default is “typescript”) to begin, and script -d to finish.

wininfo

This file begins with four integers giving the position and size of the window. After that, the file contains some strings, separated by spaces, as follows :-

Additional mouse events

The following additional mouse events are sent to the reader of the mouse file. The messages follow the same format as the m and r events, but have a different letter code.

Download

Riox is part of the Plan 9 branch of Object Icon, and is built along with the rest of Object Icon, with the riox executable ending up in the bin directory. For details, see this page.

However, since riox is a useful standalone program, a separate archive file is provided, which just contains the riox source code. This can be found here.

To build, just cd into the extracted directory and run mk. This should build riox, the ls replacement mentioned above (l), and the script shell script, also mentioned above. These executables can then be copied to convenient locations on your $path.

Contents