I'm using XMonad in a setup with multiple physical screens.
I would like each of the physical screens to have an instance of xmobar
which
shows which workspace is visible on that particular screen, regardless of whether
that workspace is "current"/"active" or not.
E.g.
+--------------+ +--------------+
| | | |
| | | |
| | | |
| | | |
+--------------+ +--------------+
|Workspace 3 | |Workspace 5 |
+--------------+ +--------------+
My current (minimized for clarity) xmonad.hs
is below.
import XMonad
import XMonad.Layout.NoBorders
import XMonad.Hooks.ManageDocks
import XMonad.Hooks.DynamicLog
import XMonad.Util.Run
import XMonad.Layout.IndependentScreens
main = do
n <- countScreens
xmprocs <- mapM (\i -> spawnPipe $ "xmobar" ++ " -x " ++ show i) [0..n-1]
xmonad $ docks def
{ layoutHook = avoidStruts $ smartBorders $ layoutHook defaultConfig
, logHook = mapM_ (\xmobarPipe -> dynamicLogWithPP $ def
{ ppOutput = hPutStrLn xmobarPipe
, ppCurrent = \s -> s
, ppVisible = \s -> ""
, ppHidden = \s -> ""
, ppLayout = \s -> ""
, ppTitle = \s -> ""
}) xmprocs
}
That is, I managed to spawn 2 instances of xmobar, one for each screen. However it simply shows the currently active Workspace (across screens) on both screens' xmobar. E.g. it would show:
+--------------+ +--------------+
| | | |
| | | |
| | | |
| | | |
+--------------+ +--------------+
|Workspace 3 | |Workspace 3 |
+--------------+ +--------------+
Now, how do I achieve what I actually want?
I think the configuration here
https://github.com/nwf/xconfig/blob/208e6d6ce48fba45ec30bb1df1389f9ff2263edd/xmonad/lib/XMonad/Actions/XMobars.hs#L163
might contain hints to the answer but I'm not proficient enough in Haskell to
work back from that example to something minimal that I can use.
This works: