xmonadxmonad-contrib

Is there a `ifWindowCount` function in xmonad?


I am trying to find a function, that allows me to switch between XMonad-Layouts automatically depending on the amount of windows on the screen.

I have experienced similar behavior with the ifWider function, which does the same depending on the screen width. I doubt that there is a function for that in xmonad-contrib, so should I implement it myself? And how would I do that?


Solution

  • I have never used it but XMonad.Layout.IfMax looks like doing exactly that. You provide a number of windows and two layouts, and it will run one layout if up to that number of windows are present, and the other one otherwise.

    import XMonad.Layout.IfMax
    
    myLayoutHook = IfMax 2 Full (Tall ...) ||| ...