xmonad-contrib-0.11.1: Third party extensions for xmonad

Portability | unportable
Stability | unstable
Maintainer | none
Safe Haskell | None

XMonad.Layout.LayoutHints

Contents

- usage

Description

Make layouts respect size hints.

Synopsis

- layoutHints :: LayoutClass l a => l a -> ModifiedLayout LayoutHints l a
- layoutHintsWithPlacement :: LayoutClass l a => (Double, Double) -> l a -> ModifiedLayout LayoutHints l a
- layoutHintsToCenter :: LayoutClass l a => l a -> ModifiedLayout LayoutHintsToCenter l a
- data LayoutHints a
- data LayoutHintsToCenter a
- hintsEventHook :: Event -> X All

# usage

You can use this module with the following in your `~/.xmonad/xmonad.hs`:

     import XMonad.Layout.LayoutHints

Then edit your `layoutHook` by adding the `layoutHints` layout modifier to some layout:

     myLayout = layoutHints (Tall 1 (3/100) (1/2))  ||| Full ||| etc..
     main = xmonad defaultConfig { layoutHook = myLayout }

Or, to center the adapted window in its available area:

     myLayout = layoutHintsWithPlacement (0.5, 0.5) (Tall 1 (3/100) (1/2))
                       ||| Full ||| etc..

Or, to make a reasonable attempt to eliminate gaps between windows:

     myLayout = layoutHintsToCenter (Tall 1 (3/100) (1/2))

For more detailed instructions on editing the layoutHook see:

XMonad.Doc.Extending

To make XMonad reflect changes in window hints immediately, add `hintsEventHook` to your `handleEventHook`.

     myHandleEventHook = hintsEventHook <+> ...

     main = xmonad defaultConfig { handleEventHook = myHandleEventHook
                                 , ... }

layoutHints :: LayoutClass l a => l a -> ModifiedLayout LayoutHints l a

layoutHintsWithPlacement :: LayoutClass l a => (Double, Double) -> l a -> ModifiedLayout LayoutHints l a

`layoutHintsWithPlacement (rx, ry) layout` will adapt the sizes of a layout's windows according to their size hints, and position them inside their originally assigned area according to the `rx` and `ry` parameters. (0, 0) places the window at the top left, (1, 0) at the top right, (0.5, 0.5) at the center, etc.

layoutHintsToCenter :: LayoutClass l a => l a -> ModifiedLayout LayoutHintsToCenter l a

`layoutHintsToCenter layout` applies hints, sliding the window to the center of the screen and expanding its neighbors to fill the gaps. Windows are never expanded in a way that increases overlap.

`layoutHintsToCenter` only makes one pass at resizing the neighbors of hinted windows, so with some layouts (ex. the arrangement with two `Mirror` `Tall` stacked vertically), `layoutHintsToCenter` may leave some gaps. Simple layouts like `Tall` are unaffected.

data LayoutHints a

Instances

LayoutModifier LayoutHints Window |
Read (LayoutHints a) |
Show (LayoutHints a) |

data LayoutHintsToCenter a

Instances

LayoutModifier LayoutHintsToCenter Window |
Read (LayoutHintsToCenter a) |
Show (LayoutHintsToCenter a) |

hintsEventHook :: Event -> X All

Event hook that refreshes the layout whenever a window changes its hints.