[xmonad] One status bar process, visible on N screens

Jacek Generowicz jacek.generowicz at cern.ch
Tue Jan 17 17:20:43 CET 2012


At Tue, 17 Jan 2012 11:08:43 -0500,
<wagnerdm at seas.upenn.edu> wrote:
> 
> Quoting Jacek Generowicz <jacek.generowicz at cern.ch>:
> 
> > Is there an easy way of finding the docs for older versions?
> 
> 0.9.2 doesn't seem to be available, but 0.9.1 is and should be quite  
> close to the same.

Hmm, I saw that 0.9.2 was missing, and assumed the same was true for
all older versions. Sigh. Less haste, more speed.


> > But if anyone has any suggestions on getting XMonad to spot the change
> > itself, I'd be interested.
> 
> Look into the eventHook. I believe clients are sent a message when the  
> number of screens change. Supposedly, xmonad itself has some machinery  
> for spotting this kind of thing, so you may be able to crib some code  
> from core.

Thanks for the suggestion. I'll file this for the long-term future. I
used your code as inspiration for:

main = do
  nScreens <- countScreens
  xmobars  <- mapM (spawnPipe . xmobarCommand) [0 .. nScreens-1]
  dzens    <- mapM (spawnPipe .   dzenCommand) [1 .. nScreens]
  xmonad myConfig 
   { 
    logHook = 
       updatePointer (Relative 1 1)
       >> mapM_ (dynamicLogWithPP . (bindPPoutput   myDzenPP)) dzens
       >> mapM_ (dynamicLogWithPP . (bindPPoutput sjanssenPP)) xmobars
   }

xmobarCommand (S n) = "xmobar -x "                    ++ show n
dzenCommand   (S n) = "dzen2 -e 'onstart=lower' -xs " ++ show n

bindPPoutput pp h = pp { ppOutput = hPutStrLn h }


With this, I just have to hit 'Mod-q' after the number of screens
changes, to get the right number of status bars. This is such a
trivial glitch compared the major configuration issues I have yet to
resolve, that I'm perfectly happy with this solution at the moment.

Thanks for your help.



More information about the xmonad mailing list