TWM ad hoc Minimal Graphical User Interface for Raspbian
Posted: Tue Apr 12, 2016 12:00 am
Greetings, the purpose of this post is to document a minimal graphical user interface for raspbian (twm tiny window manager) which is ad hoc, compatible with existing openbox, and has a very small footprint in ram.
There are many ways to accomplish this; this is one way, ad hoc, and manual-- although, it has been scripted (barely) to make the typing a little easier.
The first thing we want to do is to download the packages and fonts we will need:
Next we need to create two scripts in ~/bin/
The first is ~/bin/vt7-startx.sh
The second is ~/bin/mydesk-twm.sh
You will need to make both of them executable with :
I boot my PI into the CLI black screen, and start my X environment if and when needed. You do not need to do that, of course, you can start vt7-startx.sh with openbox already running on display :0, vt1, because vt7-startx.sh uses display :1, vt7.
From the black screen on vt1 login as PI and run the startup script:
vt7-startx.sh
The screen will go black for about two seconds while the X server is initializing, and then the twm tiny window manager will start, give you a couple of cool apps, and set the background color to darkcyan; suit yourself and change any and all of this...
This simple setup assumes a display geometry of 1920x1080 (flat panel hdmi). If yours is different you may need to change the -geometry settings in the mydesk-twm.sh script to accommodate your own setup.
If openbox was already running you can toggle between the new desk and the old desk with:
ctrl-alt-F1 <> ctrl-alt-F7
You can have more than one of these desks running at a time; however, you will have to assign unique display numbers (greater than or equal to :2) and you will need to assign a unique virtual terminal vt8, etc.
Experiment; X is fun !
notes: if the cursor is missing from the new desk just left click to get it to appear. In an app it will look normal; on the open desktop it will be the now famous X cursor (this is normal for twm)
To get to the debian main menu left click on the open desktop and follow the yellow brick road... you can drill down many levels, and all of the raspbian apps are available (most all anyways).
edit: FYI twm was the only XFree86 window manager back in the early days of gnu+linux; so, this is a bit of an historical side-bar. twm has been around (obviously) for a very long time... it was good to see that its still in the repositories.
Enjoy

There are many ways to accomplish this; this is one way, ad hoc, and manual-- although, it has been scripted (barely) to make the typing a little easier.
The first thing we want to do is to download the packages and fonts we will need:
Code: Select all
sudo apt-get install twm
sudo apt-get install x11-apps
sudo apt-get install xterm
sudo apt-get install xfonts-base
sudo apt-get install xfonts-100dpi
sudo apt-get install xfonts-75dpi
sudo apt-get install xfonts-terminus
The first is ~/bin/vt7-startx.sh
Code: Select all
#!/bin/sh
sudo /usr/bin/X -nolisten tcp :1 vt7 &
export DISPLAY=:1
sleep 2
exec ~/bin/mydesk-twm.sh
Code: Select all
xclock -display $DISPLAY -geometry 120x110+1764+30 &
xterm -display $DISPLAY -fn 9x15 -geometry 80x64+300+30 &
xcalc -display $DISPLAY -geometry +1400+694 &
exec twm -display $DISPLAY &
sleep 1
xsetroot -display $DISPLAY -solid darkcyan
Code: Select all
chmod 0754 ~/bin/mydesk-twm.sh
chmod 0754 ~/bin/vt7-startx.sh
From the black screen on vt1 login as PI and run the startup script:
vt7-startx.sh
The screen will go black for about two seconds while the X server is initializing, and then the twm tiny window manager will start, give you a couple of cool apps, and set the background color to darkcyan; suit yourself and change any and all of this...
This simple setup assumes a display geometry of 1920x1080 (flat panel hdmi). If yours is different you may need to change the -geometry settings in the mydesk-twm.sh script to accommodate your own setup.
If openbox was already running you can toggle between the new desk and the old desk with:
ctrl-alt-F1 <> ctrl-alt-F7
You can have more than one of these desks running at a time; however, you will have to assign unique display numbers (greater than or equal to :2) and you will need to assign a unique virtual terminal vt8, etc.
Experiment; X is fun !
notes: if the cursor is missing from the new desk just left click to get it to appear. In an app it will look normal; on the open desktop it will be the now famous X cursor (this is normal for twm)
To get to the debian main menu left click on the open desktop and follow the yellow brick road... you can drill down many levels, and all of the raspbian apps are available (most all anyways).
edit: FYI twm was the only XFree86 window manager back in the early days of gnu+linux; so, this is a bit of an historical side-bar. twm has been around (obviously) for a very long time... it was good to see that its still in the repositories.
Enjoy