[xmonad] xmobar

Audun Skaugen audunskaugen at gmail.com
Wed Nov 16 15:22:36 CET 2011

Norbert Zeh wrote:
> Marco Guidetti [2011.11.16 1028 +0100]:
>> Hi all,
>> I have started using xmonad very recently but so far so good, almost
>> everything works exactly as it should.
>> One of the biggest issue I am dealing with right now is xmobar.
>> I mean:
>> I use two different xmobar instances in xmonad (one at the top and one
>> at the bottom of the screen): the top one has time/battery/xmonad
>> stuff (as in windows, workspace and layout info), the bottom some
>> weather stuff/cpu and so on.
>> I start them in this way:
>>       xmproc <- spawnPipe "xmobar ~/.xmobaruprc" (for the top one,
>> which uses DynamicLog)
>> and
>>       spawn "xmobar ~/.xmobarrc" (for the bottom one)
>> Obviously this leads to having multiple instances of xmobar running
>> each time i press mod4Mask+q to restart xmonad (which happens quite
>> frequently since I am still configuring all the stuff I need and
>> playing around with xmonad to understand it better).
>> I have seen that in XMonad.Hooks.DynamicLog (xmobar) there is a way to
>> do this (even if I still don't fully comprehend how to use it for the
>> DynamicLog, for example).
>> It's not clear to me how to use for multiple xmobar instances (as in my case).
>> Can someone point to relevant examples (I have found the doc/wiki
>> page, but I don't get it)?
> I ran into the same problem.  The way I see it, the problem is that xmonad does
> not keep track of the processes it spawns.  Thus, when restarting, these
> processes stay around.  The reason why I think this does not happen with the
> xmobar spawned as a pipe to receive xmonad's log output is that the xmobar
> instance dies the moment the pipe gets closed by xmonad.
> The way I work around this (I'm running 4 xmobar instances ;) and some other
> things in my X11 session) is to wrap the invocation of xmonad into a session
> script that starts all the things I want.  Then restarting xmonad does not
> trigger rerunning the session script and all is well.  The only situation where
> I'm not happy with this solution is when I reconfigure the xmobar instances
> themselves because they still won't restart when restarting xmonad.  In this
> case, I kill them and restart them by hand.
Why not just spawn all your xmobar instances whith spawnPipe, and then 
just not using the pipe? This should properly restart all the instances 
when restarting xmonad. Or would the pipe be garbage collected too early?

More information about the xmonad mailing list