X.A.Navigation2D: More prominently document strategies

Also, add a note that users who use gaps or spacing may need to look
into these strategies a bit more deeply.

Fixes: https://github.com/xmonad/xmonad-contrib/issues/627
This commit is contained in:
Tony Zorman 2022-10-16 10:48:58 +02:00
parent 41d6ac96d5
commit cca2ccfc71

View File

@ -97,7 +97,14 @@ import XMonad.Util.Types
-- > False -- > False
-- > $ def -- > $ def
-- --
-- Alternatively, you can use navigation2DP: -- /NOTE/: the @def@ argument to 'navigation2D' contains the strategy
-- that decides which windows actually get selected. If you use modules
-- that influence tiling in some way, like "XMonad.Layout.Spacing" or
-- "XMonad.Layout.Gaps", you should think about using a different
-- strategy, if you find the default behaviour to be unnatural. Check
-- out the [finer points](#g:Finer_Points) below for more information.
--
-- Alternatively to 'navigation2D', you can use 'navigation2DP':
-- --
-- > main = xmonad $ navigation2DP def -- > main = xmonad $ navigation2DP def
-- > ("<Up>", "<Left>", "<Down>", "<Right>") -- > ("<Up>", "<Left>", "<Down>", "<Right>")
@ -107,7 +114,7 @@ import XMonad.Util.Types
-- > $ def -- > $ def
-- --
-- That's it. If instead you'd like more control, you can combine -- That's it. If instead you'd like more control, you can combine
-- withNavigation2DConfig and additionalNav2DKeys or additionalNav2DKeysP: -- 'withNavigation2DConfig' and 'additionalNav2DKeys' or 'additionalNav2DKeysP':
-- --
-- > main = xmonad $ withNavigation2DConfig def -- > main = xmonad $ withNavigation2DConfig def
-- > $ additionalNav2DKeys (xK_Up, xK_Left, xK_Down, xK_Right) -- > $ additionalNav2DKeys (xK_Up, xK_Left, xK_Down, xK_Right)
@ -178,9 +185,19 @@ import XMonad.Util.Types
-- values in the above example to 'True'. You could also decide you want -- values in the above example to 'True'. You could also decide you want
-- wrapping only for a subset of the operations and no wrapping for others. -- wrapping only for a subset of the operations and no wrapping for others.
-- --
-- By default, all layouts use the 'defaultTiledNavigation' strategy specified -- By default, all layouts use the 'defaultTiledNavigation' strategy
-- in the 'Navigation2DConfig' (by default, line navigation is used). To -- specified in the 'Navigation2DConfig' (by default, line navigation is
-- override this behaviour for some layouts, add a pair (\"layout name\", -- used). Many more navigation strategies are available; some may feel
-- more natural, depending on the layout and user:
--
-- * 'lineNavigation'
-- * 'centerNavigation'
-- * 'sideNavigation'
-- * 'sideNavigationWithBias'
--
-- There is also the ability to combine two strategies with 'hybridOf'.
--
-- To override the default behaviour for some layouts, add a pair (\"layout name\",
-- navigation strategy) to the 'layoutNavigation' list in the -- navigation strategy) to the 'layoutNavigation' list in the
-- 'Navigation2DConfig', where \"layout name\" is the string reported by the -- 'Navigation2DConfig', where \"layout name\" is the string reported by the
-- layout's description method (normally what is shown as the layout name in -- layout's description method (normally what is shown as the layout name in
@ -326,7 +343,7 @@ centerNavigation = N 2 doCenterNavigation
-- and push it to the right until it intersects with at least one other window. -- and push it to the right until it intersects with at least one other window.
-- Of those windows, one with a point that is the closest to the centre of the -- Of those windows, one with a point that is the closest to the centre of the
-- line (+1) is selected. This is probably the most intuitive strategy for the -- line (+1) is selected. This is probably the most intuitive strategy for the
-- tiled layer when using XMonad.Layout.Spacing. -- tiled layer when using "XMonad.Layout.Spacing".
sideNavigation :: Navigation2D sideNavigation :: Navigation2D
sideNavigation = N 1 (doSideNavigationWithBias 1) sideNavigation = N 1 (doSideNavigationWithBias 1)