Tuesday, 24 August 2010

LAP - Openbox

This, I should point out, is another entirely optional step.  Feel free to skip over it if the shitieness of twm does not irritate you.

twm, which is the window manager that BLFS installs with X, is crap. It generates the crappy green title bars and the left click menu. At least it is small and works, after a fashion. There is an alternative. Actually, there are many, many alternatives, but we are just going to use one of them. Openbox looks much better, and it adds stuff like virtual desktops (CTRL + ALT + left/right arrows to switch desktops). The emulator, and anything else you want to run, will still work fine without Openbox, it will just look greener and crappier. The main requirement for Openbox is GTK, and we have just installed that, so Openbox itself should be a doddle.

The only dependency that we are going to install is libxml2 which is a library for accessing (or parsing) xml files.  I think, although I am far from certain, that Openbox stores its configuration settings in .xml files, whic essentially means that it needs to be able to read xml files to be able to work.

umount -v /media/amiga 
sudo mkdir /media/lfs 
sudo mount -v -t ext3 /dev/disk/by-label/amiga /media/lfs 
cd /media/lfs/sources
mkdir desktop
chmod -v a+wt desktop
cd desktop 
wget http://xmlsoft.org/sources/libxml2-2.7.6.tar.gz 
wget http://openbox.org/dist/openbox/openbox-3.4.11.1.tar.gz 

Then from the Amiga Key:

cd /sources/desktop
tar -xzvf libxml2-2.7.6.tar.gz
cd libxml2-2.7.6
./configure --prefix=/usr
make $CORES_TO_USE
make $CORES_TO_USE check

Screeds and screeds of crap followed by:

Ran 0 tests, no errors 
Total 0 tests, no errors

Makes no sense whatsoever. It also complains about a missing part:

xmlconf/xmlconf.xml is missing
you need to fetch and extract the
latest XML Conformance Test Suites
http://www.w3.org/XML/Test/xmlts20080205.tar.gz
see http://www.w3.org/XML/Test/ for informations
I am ignoring that.
make install
cd ..
rm -rvf libxml2-2.7.6

Now for Openbox itself:
tar -xzvf openbox-3.4.11.1.tar.gz
cd openbox-3.4.11.1
./configure --prefix=/usr --sysconfdir=/etc --disable-startup-notification \
--disable-session-management
make $CORES_TO_USE
make install

I then replaced the existing ~/.xinitrc file with this one. Openbox's menu is accessed on a blank part of the desktop using the right mouse button.
cat > /root/.xinitrc << EOF
# Begin .xinitrc file
#xterm  -g 80x20+0+0   &
#xclock -g 100x100-0+0 &
exec openbox-session
EOF

cd ..
rm -rvf openbox-3.4.11.1

A quick reboot confirmed it is working. Looks MUCH better. Now lets configure openbox so that it fits our system. First of all, Openbox had installed some default configuration files in [/etc/xdg/openbox/]. These are menu.xml which sets up the right click menu, rc.xml which sets up the actual display and operation of the windows themselves, and finally autostart.sh which runs various setup commands prior to Openbox starting. We will just leave autostart.sh and rc.xml alone, as they are doing their jobs fine.

The default menu for Openbox looks bizarre for our system. We have no GUI programs apart from E-UAE and xterm, so what's the point? We'll need to replace the menu.xml with our own version. To do that, first of all make a hidden folder in our home drive, and then copy all the default configuration files into it:

mkdir -p ~/.config/openbox
cp /etc/xdg/openbox/*.* ~/.config/openbox

Then replace the menu.xml with this one:

cat > ~/.config/openbox/menu.xml << "EOF"
<?xml version="1.0" encoding="UTF-8"?>

<openbox_menu xmlns="http://openbox.org/3.4/menu">

<menu id="apps-editors-menu" label="Editors">
<item label="nano">
<action name="Execute">
<command>xterm -e /usr/bin/nano</command>
<startupnotify>
<enabled>yes</enabled>
</startupnotify>
</action>
</item>
</menu>

<menu id="apps-term-menu" label="Terminals">
<item label="Xterm">
<action name="Execute"><command>xterm</command></action>
</item>
</menu>

<menu id="apps-net-menu" label="Internet">
<item label="lynx">
<action name="Execute">
<command>xterm -e /usr/bin/lynx</command>
<startupnotify>
<enabled>yes</enabled>
</startupnotify>
</action>
</item>
</menu>

<menu id="apps-multimedia-menu" label="Multimedia">
<item label="alsamixer">
<action name="Execute">
<command>xterm -e /usr/bin/alsamixer</command>
<startupnotify>
<enabled>yes</enabled>
</startupnotify>
</action>
</item>
</menu>

<menu id="system-menu" label="System">
<item label="Openbox Configuration Manager">
<action name="Execute">
<command>obconf</command>
<startupnotify><enabled>yes</enabled></startupnotify>
</action>
</item>
<separator />
<item label="Reconfigure Openbox">
<action name="Reconfigure" />
</item>
</menu>

<menu id="root-menu" label="Openbox 3">
<separator label="Applications" />
<menu id="apps-editors-menu"/>
<menu id="apps-net-menu"/>
<menu id="apps-multimedia-menu"/>
<menu id="apps-term-menu"/>
<item label="E-UAE Emulator">
<action name="execute"><execute>/usr/bin/uae</execute></action>
</item>
<separator label="System" />
<menu id="system-menu"/>
<separator />
<item label="Log Out">
<action name="Exit">
<prompt>yes</prompt>
</action>
</item>
</menu>

</openbox_menu>
EOF
That all looks quite complicated, but it really isn't. It is split into two sections. The first defines the various submenus, and then the second section actually sets out the menu structure.

Because we have no GUI programs other than xterm and e-uae (which we will install shortly) we need to configure the other programs to be run through xterm. So for instance the [command] to run [alsamixer] is:

xterm -e /usr/bin/alsamixer

That tells the system to run [xterm] and [e]xecute the program [/usr/bin/alsamixer].

Now, if you log out and then back in, you should get a sensible right click menu which will load the applications that we have - either directly or through an xterm window.

No comments:

Post a Comment