xmonad-contrib-0.8.1: Third party extensions for xmonadSource codeContentsIndex
XMonad.Layout.Gaps
Portabilityunportable
Stabilityunstable
Maintainer<byorgey@gmail.com>
Contents
Usage
Description

Create manually-sized gaps along edges of the screen which will not be used for tiling, along with support for toggling gaps on and off.

Note that XMonad.Hooks.ManageDocks is the preferred solution for leaving space for your dock-type applications (status bars, toolbars, docks, etc.), since it automatically sets up appropriate gaps, allows them to be toggled, etc. However, this module may still be useful in some situations where the automated approach of ManageDocks does not work; for example, to work with a dock-type application that does not properly set the STRUTS property, or to leave part of the screen blank which is truncated by a projector, and so on.

Synopsis
data Direction
= U
| D
| R
| L
type GapSpec = [(Direction, Int)]
gaps :: GapSpec -> l a -> ModifiedLayout Gaps l a
data GapMessage
= ToggleGaps
| ToggleGap !Direction
| IncGap !Int !Direction
| DecGap !Int !Direction
Usage

You can use this module by importing it into your ~/.xmonad/xmonad.hs file:

 import XMonad.Layout.Gaps

and applying the gaps modifier to your layouts as follows (for example):

 layoutHook = gaps [(U,18), (R,23)] $ Tall 1 (3/100) (1/2) ||| Full  -- leave gaps at the top and right

You can additionally add some keybindings to toggle or modify the gaps, for example:

 , ((modMask x .|. controlMask, xK_g), sendMessage $ ToggleGaps)  -- toggle all gaps
 , ((modMask x .|. controlMask, xK_t), sendMessage $ ToggleGap U) -- toggle the top gap
 , ((modMask x .|. controlMask, xK_w), sendMessage $ IncGap R 5)  -- increment the right-hand gap
 , ((modMask x .|. controlMask, xK_q), sendMessage $ DecGap R 5)  -- decrement the right-hand gap

If you want complete control over all gaps, you could include something like this in your keybindings, assuming in this case you are using XMonad.Util.EZConfig.mkKeymap or XMonad.Util.EZConfig.additionalKeysP from XMonad.Util.EZConfig for string keybinding specifications:

 ++
 [ ("M-g " ++ f ++ " " ++ k, sendMessage $ m d)
     | (k, d) <- [("a",L), ("s",D), ("w",U), ("d",R)]
     , (f, m) <- [("v", ToggleGap), ("h", IncGap 10), ("f", DecGap 10)]
 ]

Given the above keybinding definition, for example, you could type M-g, v, a to toggle the top gap.

To configure gaps differently per-screen, use XMonad.Layout.PerScreen (coming soon).

data Direction Source

An enumeration of the four cardinal directions/sides of the screen.

Ideally this would go in its own separate module in Util, but ManageDocks is angling for inclusion into the xmonad core, so keep the dependencies to a minimum.

Constructors
UUp/top
DDown/bottom
RRight
LLeft
show/hide Instances
type GapSpec = [(Direction, Int)]Source
A manual gap configuration. Each side of the screen on which a gap is enabled is paired with a size in pixels.
gapsSource
::
=> GapSpecThe gaps to allow, paired with their initial sizes.
-> l aThe layout to modify.
-> ModifiedLayout Gaps l a
Add togglable manual gaps to a layout.
data GapMessage Source
Messages which can be sent to a gap modifier.
Constructors
ToggleGapsToggle all gaps.
ToggleGap !DirectionToggle a single gap.
IncGap !Int !DirectionIncrease a gap by a certain number of pixels.
DecGap !Int !DirectionDecrease a gap.
show/hide Instances
Produced by Haddock version 2.4.2