[Xmonad] Using dzen for a popup statusbar in xmonad

Donald Bruce Stewart dons at cse.unsw.edu.au
Wed Apr 25 22:31:47 EDT 2007

I've been experimenting with simple approaches to having an external
statusbar for xmonad. 

One possible option is to use dzen, a console-based X statusbar client:


Using dzen, we can , for example, have a popup clock/system status shell
script, like so:

    au=`date +"%H.%M %a %b %d"`
    uk=`TZ=GMT date +"UK %H.%M"`
    us=`TZ=America/New_York date +"NY %H.%M"`
    ca=`TZ=America/Los_Angeles date +"SF %H.%M"`
    hw=`/sbin/sysctl hw.setperf | sed "s/.*=//" | perl -anle 'print (0.6 + ($F[0]) / 100)'`
    ut=`uptime | sed 's/.*://; s/,//g'`
    bt=`/usr/sbin/apm | sed -n 's/.*: \([^ ]*\).*$/\1/;2p;4p' | xargs printf "apm %s%%, AC %s\n"`
    (printf "%s : %s : %s : %s : %s Ghz : %s :%s\n" "$au" "$uk" "$us" "$ca" "$hw" "$bt" "$ut"; sleep 10) | dzen2

So this just gathers some info from my system, then pipes a string into
dzen2, and times it out after 10 seconds.

We can then bind to this 'status' script from Config.hs:

        , ((modMask,               xK_s     ), spawn "/home/dons/bin/status")

That is, mod-s pops up a 10 second status bar with the time, and some
system info.

Probably we can do some more fun things with dzen. 

Happy hacking,

More information about the Xmonad mailing list