Skip to content

Commit

Permalink
X.L.Spacing: Extend documentation
Browse files Browse the repository at this point in the history
Users are having trouble with this module all the time.  Now that
certain helper functions are undeprecated, we should tell users how they
may use them.  It is also worth explaining the scary-looking
`spacingRaw` command a bit further.

Related: xmonad#597
  • Loading branch information
slotThe committed Aug 29, 2021
1 parent 4a63999 commit 34af6eb
Showing 1 changed file with 33 additions and 3 deletions.
36 changes: 33 additions & 3 deletions XMonad/Layout/Spacing.hs
Original file line number Diff line number Diff line change
Expand Up @@ -61,10 +61,40 @@ import XMonad.Actions.MessageFeedback
--
-- > import XMonad.Layout.Spacing
--
-- and modifying your layoutHook as follows (for example):
-- and, for example, modifying your @layoutHook@ as follows:
--
-- > layoutHook = spacingRaw True (Border 0 10 10 10) True (Border 10 10 10 10) True $
-- > layoutHook def
-- > main :: IO ()
-- > main = xmonad $ def
-- > { layoutHook = spacingWithEdge 10 $ myLayoutHook
-- > }
-- >
-- > myLayoutHook = Full ||| ...
--
-- The above would add a 10 pixel gap around windows on all sides, as
-- well as add the same amount of spacing around the edges of the
-- screen. If you only want to add spacing around windows, you can use
-- 'spacing' instead.
--
-- There is also the 'spacingRaw' command, for more fine-grained
-- control. For example:
--
-- > layoutHook = spacingRaw True (Border 0 10 10 10) True (Border 10 10 10 10) True
-- > $ myLayoutHook
--
-- Breaking this down, the above would do the following:
--
-- - @True@: Enable the 'smartBorder' to not apply borders when there
-- is only one window.
--
-- - @(Border 0 10 10 10)@: Add a 'screenBorder' of 10 pixels in every
-- direction but the top.
--
-- - @True@: Enable the 'screenBorder'.
--
-- - @(Border 10 10 10 10)@: Add a 'windowBorder' of 10 pixels in
-- every direction.
--
-- - @True@: Enable the 'windowBorder'.

-- | Represent the borders of a rectangle.
data Border = Border
Expand Down

0 comments on commit 34af6eb

Please sign in to comment.