xmonad / xmonad-contrib

Contributed modules for xmonad
https://xmonad.org
BSD 3-Clause "New" or "Revised" License
589 stars 274 forks source link

Document that `spacing` should come after `avoidStruts` #665

Closed geekosaur closed 2 years ago

geekosaur commented 2 years ago

Problem Description

This has come up a couple of times that I can recall: if you put avoidStruts after spacing in the layoutHook, avoidStruts doesn't work and spacing behaves oddly. This should be documented as a "gotcha" for users.

Configuration File

module Main (main) where

import XMonad
import XMonad.Layout.Spacing
import XMonad.Hooks.ManageDocks

main :: IO ()
main = xmonad $ docks def {
         layoutHook = spacing 2 $ avoidStruts $ layoutHook def
         }

Checklist

geekosaur commented 2 years ago

More generally, avoidStruts needs to come before anything that reduces the screen rectangle, or the struts will end up in the wrong place. I would expect general mayhem if someone attempted, say, addTabs shrinkText def (avoidStruts Simplest) for some reason. But spacing seems to be where it most commonly comes up.