xmonad-contrib-0.13: Third party extensions for xmonad

Copyright | Quentin Moser <moserq@gmail.com>
License | BSD-style (see LICENSE)
Maintainer | orphaned
Stability | unstable
Portability | unportable
Safe Haskell | None
Language | Haskell98

XMonad.Hooks.Place

Contents

- Usage
- Placement actions
- Placement policies
- Others

Description

Automatic placement of floating windows.

Synopsis

- placeFocused :: Placement -> X ()
- placeHook :: Placement -> ManageHook
- data Placement
- smart :: (Rational, Rational) -> Placement
- simpleSmart :: Placement
- fixed :: (Rational, Rational) -> Placement
- underMouse :: (Rational, Rational) -> Placement
- inBounds :: Placement -> Placement
- withGaps :: (Dimension, Dimension, Dimension, Dimension) -> Placement -> Placement
- purePlaceWindow :: Placement -> Rectangle -> [Rectangle] -> (Position, Position) -> Rectangle -> Rectangle

# Usage

This module provides a `ManageHook` that automatically places floating windows at appropriate positions on the screen, as well as an `X` action to manually trigger repositioning.

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

    import XMonad.Hooks.Place

and adding `placeHook` to your `manageHook`, for example:

    main = xmonad $ def { manageHook = placeHook simpleSmart
                                       <+> manageHook def }

Note that `placeHook` should be applied after most other hooks, especially hooks such as `doFloat` and `doShift`. Since hooks combined with `<+>` are applied from right to left, this means that `placeHook` should be the first hook in your chain.

You can also define a key to manually trigger repositioning with `placeFocused` by adding the following to your keys definition:

    , ((modm, xK_w), placeFocused simpleSmart)

Both `placeHook` and `placeFocused` take a `Placement` parameter, which specifies the placement policy to use (smart, under the mouse, fixed position, etc.). See `Placement` for a list of available policies.

# Placement actions

placeFocused :: Placement -> X () #

Repositions the focused window according to a placement policy. Works for both "real" floating windows and windows in a `WindowArranger`-based layout.

placeHook :: Placement -> ManageHook #

Hook to automatically place windows when they are created.

# Placement policies

Placement policies determine how windows will be placed by `placeFocused` and `placeHook`.

A few examples:

- Basic smart placement

    myPlacement = simpleSmart

- Under the mouse (pointer at the top-left corner), but constrained inside of the screen area

    myPlacement = inBounds (underMouse (0, 0))

- Smart placement with a preference for putting windows near the center of the screen, and with 16px gaps at the top and bottom of the screen where no window will be placed

    myPlacement = withGaps (16,0,16,0) (smart (0.5,0.5))

data Placement #

The type of placement policies

Instances

Eq Placement # |
Methods (==) :: Placement -> Placement -> Bool # (/=) :: Placement -> Placement -> Bool #
Read Placement # |
Methods readsPrec :: Int -> ReadS Placement # readList :: ReadS [Placement] # readPrec :: ReadPrec Placement # readListPrec :: ReadPrec [Placement] #
Show Placement # |
Methods showsPrec :: Int -> Placement -> ShowS # show :: Placement -> String # showList :: [Placement] -> ShowS #

smart #

Arguments

:: (Rational, Rational) | Where the window should be placed inside the available area. See `fixed`.
-> Placement |

Try to place windows with as little overlap as possible

simpleSmart :: Placement #

fixed #

Arguments

:: (Rational, Rational) | Where windows should go. (0,0) -> top left of the screen (1,0) -> top right of the screen etc
-> Placement |

Place windows at a fixed position

underMouse #

Arguments

:: (Rational, Rational) | Where the pointer should be relative to the window's frame; see `fixed`.
-> Placement |

Place windows under the mouse

inBounds :: Placement -> Placement #

Apply the given placement policy, constraining the placed windows inside the screen boundaries.

withGaps #

Arguments

:: (Dimension, Dimension, Dimension, Dimension) | top, right, bottom and left gaps
-> Placement |
-> Placement |

Same as `inBounds`, but allows specifying gaps along the screen's edges

# Others

purePlaceWindow #

Arguments

:: Placement | The placement strategy
-> Rectangle | The screen
-> [Rectangle] | The other visible windows
-> (Position, Position) | The pointer's position.
-> Rectangle | The window to be placed
-> Rectangle |

Compute the new position of a window according to a placement policy.