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

wagnerdm at seas.upenn.edu wagnerdm at seas.upenn.edu
Tue Jan 17 03:01:52 CET 2012


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 }

You will probably not need marshallPP if you are not using  
IndependentScreens. Still, perhaps you will find this starting point  
useful for your own experimentation.
~d



More information about the xmonad mailing list