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

Copyright | (c) Karsten Schoelzel <kuser@gmx.de>
License | BSD
Maintainer | Karsten Schoelzel <kuser@gmx.de>
Stability | stable
Portability | unportable
Safe Haskell | Safe-Inferred
Language | Haskell2010

XMonad.Actions.FloatKeys

Contents

- Usage

Description

Move and resize floating windows.

Synopsis

- keysMoveWindow :: ChangeDim -> Window -> X ()
- keysMoveWindowTo :: P -> G -> Window -> X ()
- keysResizeWindow :: ChangeDim -> G -> Window -> X ()
- keysAbsResizeWindow :: ChangeDim -> D -> Window -> X ()
- directionMoveWindow :: Int -> Direction2D -> Window -> X ()
- directionResizeWindow :: Int -> Direction2D -> Window -> X ()
- data Direction2D
  - = U
  - | D
  - | R
  - | L
- type P = (Position, Position)
- type G = (Rational, Rational)
- type ChangeDim = (Int, Int)

# Usage

You can use this module with the following in your `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)))

Using XMonad.Util.EZConfig syntax, we can easily build keybindings where `M-<arrow-keys>` moves the currently focused window and `M-S-<arrow-keys>` resizes it using `directionMoveWindow` and `directionResizeWindow`:

    [ ("M-" <> m <> k, withFocused $ f i)
    | (i, k) <- zip [U, D, R, L] ["<Up>", "<Down>", "<Right>", "<Left>"]
    , (f, m) <- [(directionMoveWindow 10, ""), (directionResizeWindow 10, "S-")]
    ]

For detailed instructions on editing your key bindings, see the tutorial.

keysMoveWindow :: ChangeDim -> Window -> X () Source #

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

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

`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 :: ChangeDim -> G -> Window -> X () Source #

`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 :: ChangeDim -> D -> Window -> X () Source #

`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.

directionMoveWindow :: Int -> Direction2D -> Window -> X () Source #

`directionMoveWindow delta dir win` moves the window `win` by `delta` pixels in direction `dir`.

directionResizeWindow :: Int -> Direction2D -> Window -> X () Source #

`directionResizeWindow delta dir win` resizes the window `win` by `delta` pixels in direction `dir`.

data Direction2D Source #

Two-dimensional directions:

Constructors

U | Up
D | Down
R | Right
L | Left

#### Instances

Instances details

Bounded Direction2D Source # |
Instance details Defined in XMonad.Util.Types Methods minBound :: Direction2D Source # maxBound :: Direction2D Source #
Enum Direction2D Source # |

Instance details

Defined in XMonad.Util.Types

Methods

succ :: Direction2D -> Direction2D Source #

pred :: Direction2D -> Direction2D Source #

toEnum :: Int -> Direction2D Source #

fromEnum :: Direction2D -> Int Source #

enumFrom :: Direction2D -> [Direction2D] Source #

enumFromThen :: Direction2D -> Direction2D -> [Direction2D] Source #

enumFromTo :: Direction2D -> Direction2D -> [Direction2D] Source #

enumFromThenTo :: Direction2D -> Direction2D -> Direction2D -> [Direction2D] Source #

Read Direction2D Source # |
Instance details Defined in XMonad.Util.Types Methods readsPrec :: Int -> ReadS Direction2D Source # readList :: ReadS [Direction2D] Source # readPrec :: ReadPrec Direction2D Source # readListPrec :: ReadPrec [Direction2D] Source #
Show Direction2D Source # |
Instance details Defined in XMonad.Util.Types Methods showsPrec :: Int -> Direction2D -> ShowS Source # show :: Direction2D -> String Source # showList :: [Direction2D] -> ShowS Source #
Eq Direction2D Source # |
Instance details Defined in XMonad.Util.Types Methods (==) :: Direction2D -> Direction2D -> Bool Source # (/=) :: Direction2D -> Direction2D -> Bool Source #
Ord Direction2D Source # |

Instance details

Defined in XMonad.Util.Types

Methods

compare :: Direction2D -> Direction2D -> Ordering Source #

(<) :: Direction2D -> Direction2D -> Bool Source #

(<=) :: Direction2D -> Direction2D -> Bool Source #

(>) :: Direction2D -> Direction2D -> Bool Source #

(>=) :: Direction2D -> Direction2D -> Bool Source #

max :: Direction2D -> Direction2D -> Direction2D Source #

min :: Direction2D -> Direction2D -> Direction2D Source #

type P = (Position, Position) Source #

type G = (Rational, Rational) Source #

type ChangeDim = (Int, Int) Source #