[openbox] man openbox

Jorge Almeida jjalmeida at gmail.com
Thu Sep 29 09:58:17 EDT 2011


On Thu, Sep 29, 2011 at 9:24 AM, Manolo Martínez
<manolo at austrohungaro.com> wrote:
> Jorge, you got me interested. Any chance that you could describe in more detail
> your openbox startup setup?
>
Sure. I just finished getting rid of bash (as launcher for startup
tasks; I use bash as normal interactive shell.)

xinit starts the X server and the corresponding wm program, which is:

/command/envdir ./env /usr/bin/openbox --startup
/home/jorge/.config/openbox/customstuff

In case you don't know envdir, it's part of the daemontools package.
The directory env contains files corresponding to environment
variables. envdir sets each environment variable with the contents of
the first line in the corresponding file, and then exec's the
following program.

$ ls env
LC_ADDRESS  LC_CTYPE           LC_MEASUREMENT  LC_MONETARY  LC_NUMERIC
 LC_TELEPHONE  PATH  USER
LC_COLLATE  LC_IDENTIFICATION  LC_MESSAGES     LC_NAME      LC_PAPER
 LC_TIME       TERM  XTERM_LOCALE

$ cat env/*
en_US.utf8
en_US.utf8
en_US.utf8
en_US.utf8
en_US.utf8
en_US.utf8
en_US.utf8
en_US.utf8
en_US.utf8
en_US.utf8
en_US.utf8
en_US.utf8
/command:/opt/bin:/home/jorge/bin/Bin:/home/jorge/bin:/usr/sbin:/sbin:/usr/local/bin:/usr/bin:/bin:/usr/local/sbin:/usr/sbin:/sbin
xterm
jorge
en_US.utf8

You can set any variable you want. This is not essentially different
from using the environment file from openbox, except that it doesn't
require spawning a shell just to export environment variables. Note
that I'm used to DJB packages, otherwise it would require getting used
to it.
Next, openbox starts and then executes the program "customstuff":

$ cat customstuff
#!/command/execlineb
import HOME
foreground
{ hsetroot -center ${HOME}/.config/openbox/defaultpic }
foreground
{ xmodmap ${HOME}/.Xmodmap }
foreground
{ xrdb -merge ${HOME}/.Xresources }
foreground
{ urxvtd -q -f -o }
foreground
{ setxkbmap -option terminate:ctrl_alt_bksp }

(http://www.skarnet.org/software/execline/execlineb.html)

This just sets the background picture and a few other things.
Currently, I have no autostart tasks that need to go to the
background, but it could be done too. Of course, a bash script would
do it. But execlineb and etc are compiled statically against dietlibc,
and that makes very small binaries and no loading of libraries. The
startup is really fast. Of course, it might depend on what tasks you
need to start (I don't need KDE/Gnome stuff, and dbus is already up,
started by the distro)

The point is that the number of phases in the startup process is kept
to a minimum and the programs involved are really lightweight. This is
feasible for a custom setup, as you don't need to address the needs of
different users that would want it to "just work"

(I don't really use xinit directly, but it amounts to that.)

Cheers

Jorge


More information about the openbox mailing list