~sirjofri/rcgui

PoC GUI implementation for rc (Plan 9)
adds sample rc gui with screenshot
first working version. look at README.md

refs

master
browse  log 

clone

read-only
https://git.sr.ht/~sirjofri/rcgui
read/write
git@git.sr.ht:~sirjofri/rcgui

You can also use your local clone with git send-email.

#rcgui

Use rc to make GUI applications in Plan 9.

sample image

#Scope and Intention

Consider this software as a proof of concept that might grow into a product.

This software uses libcontrol to display graphics using standard Plan 9 graphics routines.

Currently only textbutton and label is supported. You can place the objects where you want using rect.

#Invocation

rcgui [ -n windowname ] name.

It posts its interface in /srv/name and prepares the window for graphics.

Using rc (or con) you can get a shell interface with that window:

; con -C /srv/name
init

The application assumes some application lifecycle that looks like this:

  1. Initialize the window. Create controls, name them.
  2. Redraw the window. Actually place the controls.
  3. Interactive loop. User can click buttons etc, application can react.
  4. Shutdown and quit. Can be done by rc app or hitting [DEL] key.

#Sample Session

This sample session illustrates the idea. Comments are added for clarity only!

; con -C /srv/name
init    # request by rcgui
create label mylabel
mylabel value 'hello world'
mylabel rect 10,10,200,50
create textbutton mybtn
mybtn text 'click me'
mybtn rect 10,40,200,60
activate mybtn
rinit   # stop initializing window
redraw  # request by rcgui
mylabel show
mybtn show
rredraw # stop redrawing

After this session the user can click the click me button and the shell returns the click value.

The idea is that you can build rc functions around and interact with this interface, like this:

fn init{
	cat <<.
create label mylabel
mylabel value 'hello world'
mylabel rect 10,10,200,50
create textbutton mybtn
mybtn text 'click me'
mybtn rect 10,40,200,60
activate mybtn
rinit
.
}
	
fn redraw{
	cat <<.
mylabel show
mybtn show
rredraw
.
}

I still need to figure out how to combine this.