Plan 9 : The Infinity Notebook

 

Plan 9 is an Operating System (OS) from Bell Labs which is a successor to UNIX. It builds on the learnings from the previous Operating systems. Network computing and graphics is an integral part of the OS rather than an afterthought. It is modular and portable - it comes with a cross compiler. It is available, under MIT License, which anybody can use, learn and tweak.

Features

  • Everything is a file.
  • Singular Grid: All the computers running Plan 9 OS and connected together act like a singular grid. So there's no need for remote access solutions like VNC or RDP. This cool video shows a small glimpse of the possibilities.
  • Process Isolation: Processes run within their own namespaces and are isolated from each other. So you can run rio (the window manager) within rio. Applications like Browsers don't need complicated sandboxing. And a crashing program is unlikely to bring down the OS.
  • No DLL Hell: Binaries are always statically linked. So there's no DLL hell and there's no need for application bundles like Snap, Flatpak and Appimage.
  • Plumber: This allows user to define custom rules for disparate application interactions. e.g. opening a browser for HTTP URL or a mail client for mailto URL or a text editor for a file URL.
  • Rune: Unicode (UTF) character handling (multi-lingual support) is easily done via Rune API.
  • Threads and procs occupy a shared address space, communicating and synchronizing through channels and shared variables. A proc is a Plan 9 process that contains one or more cooperatively–scheduled threads.

 

Plan 9 Keybindings

Plan 9 OS user interface (UI) is mouse oriented. However, thanks to Common User Access (CUA) specification, we have come to expect keyboard shortcuts to work for certain repeated actions. e.g. Ctrl+x, Ctrl+c and Ctrl+v for cut, copy and paste respectively. This is an attempt to introduce the same in Plan 9.

 

Rio Autosuggest


 Rio supports basic auto-suggest via Ctrl+F. Here's an attempt to add a drop-down for the same.

 

Code (Work in Progress)


Plumber

Running rules are in /mnt/plumb/rules. For permanent changes, modify /sys/lib/plumb/basic.

Some useful plumbing rules: treason (video)

# video
type is text
data matches '[a-zA-Z¡-￿0-9_\-.,/]+'
data matches '([a-zA-Z¡-￿0-9_\-.,/]+)\.(mp4|MP4|avi|mkv)'
arg isfile    $0
plumb to video
plumb start window -scroll treason $file 
   

 

Truetype Font

ttfrender output

Truetype fonts (TTF variable width font) work somewhat fine - you can notice some jarring. Just follow the manual (man truetypefs) and remember that /n/ttf is a virtual filesystem - don't expect to see any files listed there.

# ttfrender uses an actual TTF file - not the one served by truetypefs. It writes the output to the stdout
ttfrender -p 72 /lib/font/ttf/bold.ttf a.txt > a.bmp
 
# bold.ttf must exist in /lib/font/ttf/bold.ttf
truetypefs
font=/n/ttf/bold.ttf.16/font
acme -c 1 /lib/glass
   

 

Graphics

Showcasing simple geometrical shapes - lines, circle, ellipse and bezier curves.


 

Plotting

Plot interprets plotting instructions (see plot(7)) from the standard input, drawing the results in the window. Plot persists until a newline is typed in the window.

 

Sample plotting instructions

: Starts a comment
: Set up the co-ordinate system
ra 0 0 200 200

: Line
li 0 0 200 200

: Box
bo 10 10 20 20

: Circle
ci 40 40 30

: Move to 100,100 and write text
m  100 100
t  "Hello Plan9"

: Polygon
pol {
  160.00 100.00  151.96 120.00  130.00 134.64  100.00 140.00
  70.00 134.64   48.04 120.00   40.00 100.00   48.04 80.00
  70.00 65.36    100.00 60.00   130.00 65.36   151.96 80.00
  160.00 100.00
}
   

 

The graph command takes data points and generates the plot commands as output. To generate a visual graph, the pipeline looks like:

cat data.txt | graph | plot
 
graph < data.txt | plot
 
echo "1 1
2 4
3 9
4 16
5 25" | graph | plot    
 

 

References

Comments

Popular posts from this blog

HTML Renderer (Emacs)

Emacs: Binary File Viewer

Emacs: A non-intrusive browser