xmonad-contrib-0.18.0: Community-maintained extensions for xmonad

Copyright | (c) David Roundy <droundy@darcs.net>
License | BSD
Maintainer | none
Stability | unstable
Portability | unportable
Safe Haskell | Safe-Inferred
Language | Haskell2010

XMonad.Layout.LayoutHints

Contents

- usage
- For developers

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
- placeRectangle :: RealFrac r => (r, r) -> Rectangle -> Rectangle -> Rectangle

# usage

You can use this module with the following in your `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 def { 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 the tutorial and XMonad.Doc.Extending.

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

    myHandleEventHook = hintsEventHook <> ...

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

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

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

`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 Source #

`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 Source #

#### Instances

Instances details

LayoutModifier LayoutHints Window Source # |

Instance details

Defined in XMonad.Layout.LayoutHints

Methods

modifyLayout :: LayoutClass l Window => LayoutHints Window -> Workspace WorkspaceId (l Window) Window -> Rectangle -> X ([(Window, Rectangle)], Maybe (l Window)) Source #

modifyLayoutWithUpdate :: LayoutClass l Window => LayoutHints Window -> Workspace WorkspaceId (l Window) Window -> Rectangle -> X (([(Window, Rectangle)], Maybe (l Window)), Maybe (LayoutHints Window)) Source #

handleMess :: LayoutHints Window -> SomeMessage -> X (Maybe (LayoutHints Window)) Source #

handleMessOrMaybeModifyIt :: LayoutHints Window -> SomeMessage -> X (Maybe (Either (LayoutHints Window) SomeMessage)) Source #

pureMess :: LayoutHints Window -> SomeMessage -> Maybe (LayoutHints Window) Source #

redoLayout :: LayoutHints Window -> Rectangle -> Maybe (Stack Window) -> [(Window, Rectangle)] -> X ([(Window, Rectangle)], Maybe (LayoutHints Window)) Source #

pureModifier :: LayoutHints Window -> Rectangle -> Maybe (Stack Window) -> [(Window, Rectangle)] -> ([(Window, Rectangle)], Maybe (LayoutHints Window)) Source #

hook :: LayoutHints Window -> X () Source #

unhook :: LayoutHints Window -> X () Source #

modifierDescription :: LayoutHints Window -> String Source #

modifyDescription :: LayoutClass l Window => LayoutHints Window -> l Window -> String Source #

Read (LayoutHints a) Source # |
Instance details Defined in XMonad.Layout.LayoutHints Methods readsPrec :: Int -> ReadS (LayoutHints a) Source # readList :: ReadS [LayoutHints a] Source # readPrec :: ReadPrec (LayoutHints a) Source # readListPrec :: ReadPrec [LayoutHints a] Source #
Show (LayoutHints a) Source # |
Instance details Defined in XMonad.Layout.LayoutHints Methods showsPrec :: Int -> LayoutHints a -> ShowS Source # show :: LayoutHints a -> String Source # showList :: [LayoutHints a] -> ShowS Source #

data LayoutHintsToCenter a Source #

#### Instances

Instances details

LayoutModifier LayoutHintsToCenter Window Source # |

Instance details

Defined in XMonad.Layout.LayoutHints

Methods

modifyLayout :: LayoutClass l Window => LayoutHintsToCenter Window -> Workspace WorkspaceId (l Window) Window -> Rectangle -> X ([(Window, Rectangle)], Maybe (l Window)) Source #

modifyLayoutWithUpdate :: LayoutClass l Window => LayoutHintsToCenter Window -> Workspace WorkspaceId (l Window) Window -> Rectangle -> X (([(Window, Rectangle)], Maybe (l Window)), Maybe (LayoutHintsToCenter Window)) Source #

handleMess :: LayoutHintsToCenter Window -> SomeMessage -> X (Maybe (LayoutHintsToCenter Window)) Source #

handleMessOrMaybeModifyIt :: LayoutHintsToCenter Window -> SomeMessage -> X (Maybe (Either (LayoutHintsToCenter Window) SomeMessage)) Source #

pureMess :: LayoutHintsToCenter Window -> SomeMessage -> Maybe (LayoutHintsToCenter Window) Source #

redoLayout :: LayoutHintsToCenter Window -> Rectangle -> Maybe (Stack Window) -> [(Window, Rectangle)] -> X ([(Window, Rectangle)], Maybe (LayoutHintsToCenter Window)) Source #

pureModifier :: LayoutHintsToCenter Window -> Rectangle -> Maybe (Stack Window) -> [(Window, Rectangle)] -> ([(Window, Rectangle)], Maybe (LayoutHintsToCenter Window)) Source #

hook :: LayoutHintsToCenter Window -> X () Source #

unhook :: LayoutHintsToCenter Window -> X () Source #

modifierDescription :: LayoutHintsToCenter Window -> String Source #

modifyDescription :: LayoutClass l Window => LayoutHintsToCenter Window -> l Window -> String Source #

Read (LayoutHintsToCenter a) Source # |
Instance details Defined in XMonad.Layout.LayoutHints Methods readsPrec :: Int -> ReadS (LayoutHintsToCenter a) Source # readList :: ReadS [LayoutHintsToCenter a] Source # readPrec :: ReadPrec (LayoutHintsToCenter a) Source # readListPrec :: ReadPrec [LayoutHintsToCenter a] Source #
Show (LayoutHintsToCenter a) Source # |
Instance details Defined in XMonad.Layout.LayoutHints Methods showsPrec :: Int -> LayoutHintsToCenter a -> ShowS Source # show :: LayoutHintsToCenter a -> String Source # showList :: [LayoutHintsToCenter a] -> ShowS Source #

hintsEventHook :: Event -> X All Source #

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

# For developers

placeRectangle :: RealFrac r => (r, r) -> Rectangle -> Rectangle -> Rectangle Source #

`placeRectangle (rx, ry) r0 r` will return a new rectangle with the same dimensions as `r`, but positioned inside of `r0` as specified by the (rx, ry) parameters (see `layoutHintsWithPlacement`).