How can I automatically update the number of windows in the master pane to be the same as or close to the number of windows in the slave pane, while still supporting the default mod-, and mod-. keys? I've tried to configure XMonad to arrange windows how I want them automatically, and this is the one area where I still find myself making frequent manual adjustments.

I think I want to send IncMasterN messages at open/close, depending on which column has more windows (or at least that would be enough to get me started), but I'm not clear on how to find nmaster at run-time, and my previous attempt at sending such a message seemed to result in an infinite loop (see excerpt below; CPU usage went to 100% and XMonad stopped responding, like it was still stuck in the log hook). Any tips?

main = do
    xmonad $ gnomeConfig {
        logHook    =  balancePanes
    } where
        balancePanes :: X()
        balancePanes = do
            ws <- gets windowset
            let howMany = windowCount ws in do
                when (howMany == 3) (sendMessage (IncMasterN 1))

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.