xmonad-contrib-0.11.1: Third party extensions for xmonad

Portability | unportable
Stability | stable
Maintainer | Karsten Schoelzel <kuser@gmx.de>
Safe Haskell | None

XMonad.Actions.FloatKeys

Contents

- Usage

Description

Move and resize floating windows.

Synopsis

- keysMoveWindow :: D -> Window -> X ()
- keysMoveWindowTo :: P -> G -> Window -> X ()
- keysResizeWindow :: D -> G -> Window -> X ()
- keysAbsResizeWindow :: D -> D -> Window -> X ()
- type P = (Position, Position)
- type G = (Rational, Rational)

# Usage

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

        import XMonad.Actions.FloatKeys

Then add appropriate key bindings, for example:

      , ((modm,               xK_d     ), withFocused (keysResizeWindow (-10,-10) (1,1)))
      , ((modm,               xK_s     ), withFocused (keysResizeWindow (10,10) (1,1)))
      , ((modm .|. shiftMask, xK_d     ), withFocused (keysAbsResizeWindow (-10,-10) (1024,752)))
      , ((modm .|. shiftMask, xK_s     ), withFocused (keysAbsResizeWindow (10,10) (1024,752)))
      , ((modm,               xK_a     ), withFocused (keysMoveWindowTo (512,384) (1%2,1%2)))

For detailed instructions on editing your key bindings, see XMonad.Doc.Extending.

keysMoveWindow :: D -> Window -> X ()

`keysMoveWindow (dx, dy)` moves the window by `dx` pixels to the right and `dy` pixels down.

keysMoveWindowTo :: P -> G -> Window -> X ()

`keysMoveWindowTo (x, y) (gx, gy)` moves the window relative point `(gx, gy)` to the point `(x,y)`, where `(gx,gy)` gives a position relative to the window border, i.e. `gx = 0` is the left border, `gx = 1` is the right border, `gy = 0` is the top border, and `gy = 1` the bottom border.

For example, on a 1024x768 screen:

     keysMoveWindowTo (512,384) (1%2, 1%2) -- center the window on screen
     keysMoveWindowTo (1024,0) (1, 0)      -- put window in the top right corner

keysResizeWindow :: D -> G -> Window -> X ()

`keysResizeWindow (dx, dy) (gx, gy)` changes the width by `dx` and the height by `dy`, leaving the window-relative point `(gx, gy)` fixed.

For example:

     keysResizeWindow (10, 0) (0, 0)      -- make the window 10 pixels larger to the right
     keysResizeWindow (10, 0) (0, 1%2)    -- does the same, unless sizeHints are applied
     keysResizeWindow (10, 10) (1%2, 1%2) -- add 5 pixels on each side
     keysResizeWindow (-10, -10) (0, 1)   -- shrink the window in direction of the bottom-left corner

keysAbsResizeWindow :: D -> D -> Window -> X ()

`keysAbsResizeWindow (dx, dy) (ax, ay)` changes the width by `dx` and the height by `dy`, leaving the screen absolute point `(ax, ay)` fixed.

For example:

     keysAbsResizeWindow (10, 10) (0, 0)   -- enlarge the window; if it is not in the top-left corner it will also be moved down and to the right.

type P = (Position, Position)

type G = (Rational, Rational)