OpenBSD Puffy and   XMonad logo

The story of little xmonad in the deep waters of the big bad Puffy

This page is quite under construction since yesterday (20-Sept-2007)
and YES it's the same css, the same format as xmonad.org.


all about pain

    xmonad 0.2 is in the ports. Nice. Do I want that ? No. Why ? Well because it does not support the shiny new floating layer and because I wanted to hurt myself. If you wonder what a floating layer is then you are in the wrong place my friend. This page could hurt you and your cute OpenBSD box.

what you need to do

Andrei's desk
  • get yourself a shiny new OpenBSD -current (here is some documentation)
  • get the shiny new ports to match your -current (I use CVSup)
  • build the newest ghc from the ports (building this could take a long while)
  • get the xmonad 0.3 sources from here
  • grab the hs-X11-extras 0.3 from here
  • also get dzen2 installed. You'll find it in the ports

    So, here we are wanting to install the new xmonad 0.3 with floating layer features. I have to mention that I had an OpenBSD 4.1 and I upgraded it to -current. I am not going to detail the upgrade process it's all explained in the FAQ, I used that you sould use that too. What am I going to to is... well, I'm going to tell a story of my xmonad installation.
    After you have the new OpenBSD -current ready and running, update the ports and install ghc. I installed my xmonad with $PREFIX=$HOME which means that I have a ./bin directory in my $HOME which contains the xmonad binaries. I did this because I didn't want to install xmonad out in the system, it's more clean for me since the installer of xmonad is capable of installing binaries in my home using the --user argument.
    There are some dependecies to xmonad, most likely you have some of them installed since you installed ghc. I needed only the hs-X11-extras. Assuming you already got the package, unpack it:

tar xzvf X11-extras-0.3.tar.gz
cd X11-extras-0.3
runhaskell Setup.lhs configure
runhaskell Setup.lhs build
runhaskell Setup.lhs install

    I installed the X11-extras not using --prefix=${HOME}. Don't ask me why.
    Now, unpack xmonad:

tar xzvf xmonad-0.3.tar.gz
cd xmonad-0.3
mkdir ${HOME}/bin
runhaskell Setup.lhs configure --prefix=${HOME}
runhaskell Setup.lhs build
runhaskell Setup.lhs install --user


    Now you should have a binary xmonad in ${HOME}/bin. We'll use that with ${HOME}/.xinitrc for starting the windowmanager at X start. My .xinitrc looks something like this:

#set keyboard repeat rate. I like it fast !
xset r rate 250 50

#killing all xidle processes and starting a fresh one. This is used for the automatic lock of the screen
# on 90 seconds of inactivity.
pkill xidle
xidle -delay 5 -sw -program "/usr/X11R6/bin/xlock -mode blank" -timeout 90 &

#set the wallaper (I'm using windowmaker's wmsetbg as you can see)
wmsetbg /home/andreig/personal/pix/openbsd_wallpaper_1600x1200_mirrored.jpg

#clean all dzen2 processes and start some fresh ones.
pkill dzen2
$HOME/bin/header.sh &
$HOME/bin/weather.sh &
$HOME/bin/clock.sh &

#clean all gkrellm processes and bla bla
pkill gkrellm
gkrellm &

#and finally start xmoand
exec $HOME/bin/run-xmonad.sh

    You might have noticed, the weather.sh script contains a call to dzenWeather.pl. I keep this script along with the weather status icons in a folder. You can get a tar.gz of my dzenWeather folder here. The dzenWeather.pl makes use of the Weather::Com::Finder module. You can install this module from the ports in the www category. This is what you have to install p5-Weather-Com. Just in case you don't know how to install a port...

cd /usr/ports/www/p5-Weather-Com
make install clean


And now a little bit about DeManage (Spencer Janssen's module) from Contrib and gkrellm...

    Well first you need the DeManage module Spencer Janssen has written. I advise you to grab the whole (XMonadContrib-0.3) package of extensions and place them in the xmonad-0.3 folder. The xmonad-0.3 folder is the one you unpacked from xmonad-0.3.tar.gz, it's where your xmonad sources are. I keed this folder right in my ${HOME} named xmonad. You may have noticed that already in my shell scripts. So now you should have the XMonadContrib folder in your xmonad sources folder. As Spencer Janssen stated in the souce of his module, DeManage "provides a method to cease management of a window, without unmapping it. This is especially useful for applications like kicker and gnome-panel."

To make a panel display correctly with xmonad:
  • Determine the pixel size of the panel, add that value to defaultGaps (in xmonad/Config.hs)
  • Launch the panel
  • Give the panel window focus, then press mod-d
  • Convince the panel to move/resize to the correct location. Changing the panel's position setting several times seems to work.

    My defaultGaps looks like this (find defaultGaps in your Config.hs):

defaultGaps = [(12,15,0,48)]

defaultGaps explained:
  • first, 12 my top gap for header.sh dzen (hostname, uptime, load, CPU fan RPM, CPU temp, etc.
  • 15 weahter and clock dzens at the bottom. weather.sh displays the weather, clock.sh displays the clock. Nice ha ? I bet that wouldn't cross your mind.
  • 0 for my left gap. I lost this one.
  • 48 for my gkrellm. I gave it many shots till I got this lucky number 48 :)
    To install DeManage put the following bolded lines in your Config.hs file: (the import at the top, the keybinding in the keybindings section)

import XMonadContrib.DeManage
.....
-- The key bindings list. <-- after you see this look for a place to put the keybinding for DeManage.
....
, ((modMask, xK_d ), withFocused demanage)

Attention, after you modify your Config.hs in you must do the following:

runhaskell Setup.lhs build
runhaskell Setup.lhs install --user

After that restart your xmonad windowmanager. I run the install --user with xmonad process killed.

...and a little about unmanage.c (Robert Manea's unmanage tool) and gkrellm.

    Robert Manea has written a tool to unmanage a window given it's window id. You could do this to automatically unmanage gkrellm after placing it in the gap whithout installing Spencer Janssen's DeManage module. You can get unmanage.c here.

On OpenBSD, compile unmanage with:

cc -L/usr/X11R6/lib/ -I/usr/X11R6/include -lc -lX11 -o unmanage unmanage.c

To start "unmanaging" gkrellm automatically place the following after the call to gkrellm in your .xinitrc:

UNMANAGEME="gkrellm" ${HOME}/bin/unmanage `xwininfo -name "$UNMANAGEME" | sed -e 's/^xwininfo: Window id: \(0x[0-9abcdef]*\).*/\1/p;d'`

You can replace "gkrellm" with any panel name, of course.