xmonad-contrib-0.11.1: Third party extensions for xmonad

Portability | unportable
Stability | unstable
Maintainer | daniel@wagner-home.com
Safe Haskell | None

XMonad.Actions.Warp

Contents

- Usage

Description

Warp the pointer to a given window or screen.

Synopsis

- banish :: Corner -> X ()
- banishScreen :: Corner -> X ()
- data Corner
  - = UpperLeft
  - | UpperRight
  - | LowerLeft
  - | LowerRight
- warpToScreen :: ScreenId -> Rational -> Rational -> X ()
- warpToWindow :: Rational -> Rational -> X ()

# Usage

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

     import XMonad.Actions.Warp

then add appropriate keybindings to warp the pointer; for example:

     , ((modm,   xK_z     ), warpToWindow (1%2) (1%2)) -- @@ Move pointer to currently focused window

    -- mod-ctrl-{w,e,r} @@ Move mouse pointer to screen 1, 2, or 3

       [((modm .|. controlMask, key), warpToScreen sc (1%2) (1%2))
           | (key, sc) <- zip [xK_w, xK_e, xK_r] [0..]]

Note that warping to a particular screen may change the focus.

banish :: Corner -> X ()

Move the mouse cursor to a corner of the focused window. Useful for uncluttering things.

Internally, this uses numerical parameters. We parametrize on the `Corner` type so the user need not see the violence inherent in the system.

`warpToScreen` and `warpToWindow` can be used in a variety of ways. Suppose you wanted to emulate Ratpoison's 'banish' command, which moves the mouse pointer to a corner? warpToWindow can do that!

banishScreen :: Corner -> X ()

Same as `banish` but moves the mouse to the corner of the currently focused screen

data Corner

Constructors

UpperLeft |
UpperRight |
LowerLeft |
LowerRight |

warpToScreen :: ScreenId -> Rational -> Rational -> X ()

Warp the pointer to the given position (top left = (0,0), bottom right = (1,1)) on the given screen.

warpToWindow :: Rational -> Rational -> X ()

Warp the pointer to a given position relative to the currently focused window. Top left = (0,0), bottom right = (1,1).