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

Jacek Generowicz jacek.generowicz at cern.ch
Tue Jan 17 11:00:54 CET 2012

At Mon, 16 Jan 2012 21:01:52 -0500,
<wagnerdm at seas.upenn.edu> wrote:
> Quoting Jacek Generowicz <jacek.generowicz at cern.ch>:
> > How about getting XMonad to figure out how many screens there are, and
> > to start one on each screen? Maybe even removing/adding them as
> > screens are (dis-)connected?
> Here is a snippet from my xmonad.hs (with a few complicating factors removed):
> import XMonad
> import XMonad.Hooks.DynamicLog
> import XMonad.Layout.IndependentScreens
> import XMonad.Util.Run
> main = do
>      nScreens <- countScreens
>      hs       <- mapM (spawnPipe . xmobarCommand) [0 .. nScreens-1]
>      xmonad $ defaultConfig {
>          logHook = mapM_ dynamicLogWithPP $ zipWith pp hs [0..nScreens]
>          }
> xmobarCommand (S s) = unwords ["xmobar", "-x", show s, "-t",  
> "%date%%StdinReader%"]
> pp h s = marshallPP s defaultPP { ppOutput = hPutStrLn h }

That's great as a starting point. Many thanks.

Did marshallPP and defaultPP appear in IndependentScreens between
xmonad-contrib versions 0.9.2 and 0.10? Is there an easy way of
finding the docs for older versions?

As for adapting the number of status bars to the current number of
screens, with something like the above in place, it's just a question
of restarting xmonad when the screen configuration changes, which
would be a workable solution.

But if anyone has any suggestions on getting XMonad to spot the change
itself, I'd be interested.

Thank you.

More information about the xmonad mailing list