- two ways to balance the tree (retile and readjust ratio)
- tree transformations like swap and rotate also affect windows, which is more intuitive
- support for mouse resizing (with BorderResize or MouseResize)
- FocusParent message to select a group of windows for an action instead of a single one for better control (sometimes without this swap or rotate just are not possible)
====================
BinarySpacePartition (BSP) is an XMonad Layout where new windows will split the focused window in half. This is based off of https://github.com/baskerville/bspwm.
The BSP can be manipulated to create highly configurable layouts. By default new windows split the current window by alternating vertical and horizontal splits. Nodes of the tree can be rotated to change the axis of the split, and the two children of a node can be swapped.
The layout provides the following messages:
Rotate
which rotates a split between vertical and horizontalSwap
which swaps to sibling nodesExpandTowards dir
which takes a Direction2D argument (U
,D
,L
,R
) and expands the selected window's border in that directionShrinkFrom dir
which takes a Direction2D argument and shrinks the selected window's border from that directionMoveSplit dir
which takes a Direction2D argument and tries to intelligently move some border in that direction. This mode seems a bitmore intuitive to some people.
To use BSP, import the module in your ~/.xmonad/xmonad.hs
file:
import XMonad.Layout.BinarySpacePartition
Then add the layout, using the default BSP:
myLayout = emptyBSP ||| etc ..
It will be helpful to add the following keybindings:
, ((modm .|. altMask, xK_l ), sendMessage $ ExpandTowards R)
, ((modm .|. altMask, xK_h ), sendMessage $ ExpandTowards L)
, ((modm .|. altMask, xK_j ), sendMessage $ ExpandTowards D)
, ((modm .|. altMask, xK_k ), sendMessage $ ExpandTowards U)
, ((modm .|. altMask .|. ctrlMask , xK_l ), sendMessage $ ShrinkFrom R)
, ((modm .|. altMask .|. ctrlMask , xK_h ), sendMessage $ ShrinkFrom L)
, ((modm .|. altMask .|. ctrlMask , xK_j ), sendMessage $ ShrinkFrom D)
, ((modm .|. altMask .|. ctrlMask , xK_k ), sendMessage $ ShrinkFrom U)
, ((modm, xK_r ), sendMessage Rotate)
, ((modm, xK_s ), sendMessage Swap)
Here's an alternative key mapping, this time using additionalKeysP, arrow keys, and slightly different behavior when resizing windows
, ("M-M1-<Left>", sendMessage $ ExpandTowards L)
, ("M-M1-<Right>", sendMessage $ ShrinkFrom L)
, ("M-M1-<Up>", sendMessage $ ExpandTowards U)
, ("M-M1-<Down>", sendMessage $ ShrinkFrom U)
, ("M-M1-C-<Left>", sendMessage $ ShrinkFrom R)
, ("M-M1-C-<Right>", sendMessage $ ExpandTowards R)
, ("M-M1-C-<Up>", sendMessage $ ShrinkFrom D)
, ("M-M1-C-<Down>", sendMessage $ ExpandTowards D)
, ("M-s", sendMessage $ Swap)
, ("M-M1-s", sendMessage $ Rotate)
And to use the alternate resizing mode:
, ((myModKey .|. controlMask, xK_Left ), sendMessage $ MoveSplit L)
There are some more operations you might find useful:
, ((myModMask .|. mod1Mask, xK_Up), sendMessage $ FlipH)
, ((myModMask .|. mod1Mask, xK_Down), sendMessage $ FlipV)
, ((myModMask .|. mod1Mask, xK_Right), sendMessage $ RotateR)
, ((myModMask .|. mod1Mask, xK_Left), sendMessage $ RotateL)
, ((myModMask, xK_a), sendMessage Balance)
, ((myModMask, xK_f), sendMessage CirculateR)
, ((myModMask, xK_g), sendMessage CirculateL)