Xmonad:LayoutHook
lastmod 2020-12-01created 2020-12-015 edits
When you start an application that opens a new window, change the focused window, move to another workspace, or change the layout of that workspace, xmonad uses the layoutHook to rearrange the visible windows on the visible workspace.
layoutHook can be thought of as the list of layouts that xmonad will use to place windows on the screen. The combination of layouts to use is created with |||, a specific layout combinator.
Example
If you need layouts in the order Full, Tabbed, Accordion, add them as follows.
import XMonad
import XMonad.Layout.Tabbed
import XMonad.Layout.Accordion
mylayoutHook = Full ||| tabbed shrinkText def ||| Accordion
-- ...
main = xmonad $ def { layoutHook = mylayoutHook }
Pressing Mod+Space cycles through them in the order joined with |||.
Applying to all layouts
Instead of applying a layout modifier to each layout, you can apply it to the whole layout combination.
For example, if you use the noBorders layout modifier from the XMonad.Layout.NoBorders module:
import XMonad.Layout.NoBorders
-- ...
mylayoutHook = noBorders (Full ||| tabbed shrinkText def ||| Accordion)
If you want only the Tabbed layout to have no border: