これは、この質問のフォローアップです。
自分が持っている物理モニターの数を探すために、私は思いついた
screenCount :: X Int
screenCount = withDisplay (io.fmap length.getScreenInfo)
makeXMobars :: X [Handle] -- loads two xmobars per screen, one top & one bottom
makeXMobars = screenCount >>= (io.mapM spawnPipe.commandHandles )
where
commandHandles n = map ((\x -> "xmobar -x " ++ x).unwords) $ commandNames n
commandNames n = sequence [map show [0..n], map (\x -> "~/.xmobarrc" ++ x) ["Top", "Bottom"]]
myLogHook :: X ()
myLogHook = do
handles <- makeXMobars
dynamicLogWithPP $ defaultPP
{
ppOutput = \x -> mapM_ (`hPutStrLn` x) handles
}
myLogHookはにドロップインしxmonad $ DefaultConfig
ます。ただし、XMonadをロードすると、上部のXMobarのPipeReader(両方の画面)updating
が少しの間表示されてから消え、リロードすると元に戻りません。下のものは完全に幸せです。
以前は、単にppOutputに使用していました。
ppOutput = \x -> hPutStrLn xmobarTopScreen0 x >> hPutStrLn xmobarTopScreen1 x
これは完全にうまくいきました。
コード自体が悪いというよりも、IOの理解に誤りがあったと思いますが、よくわかりません。