haskellxmonadxmobar

How to spawn XMobar instance for each screen?


This question has an appropriate answer, but it's hiding everything I found difficult inside "spawn xmobar" comment.
- How to spawn one instance of xmobar for different screens?
- If this is not an option, how to spawn multiple instances on multiple screens?
- How to setup logHook with multiple instances of xmobar?


Solution

  • e.g. something like this:

    import XMonad
    import XMonad.Util.Run
    import XMonad.Layout.IndependentScreens
    
    main = do
        n <- countScreens
        xmprocs <- mapM (\i -> spawnPipe $ "xmobar /home/biskulopty/.xmobarrc-" ++ show i ++ " -x " ++ show i) [0..n-1]
        xmonad def {
            logHook = {- use xmprocs, which is a list of pipes of type [Handle] -}
        }