XMonad.Actions.UpdatePointer

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

Copyright | (c) Robert Marlow <robreim@bobturf.org> 2015 Evgeny Kurnevsky
License | BSD3-style (see LICENSE)
Maintainer | Robert Marlow <robreim@bobturf.org>
Stability | stable
Portability | portable
Safe Haskell | None
Language | Haskell2010

XMonad.Actions.UpdatePointer

Contents

- Usage

Description

Causes the pointer to follow whichever window focus changes to. Compliments the idea of switching focus as the mouse crosses window boundaries to keep the mouse near the currently focused window

Synopsis

- updatePointer :: (Rational, Rational) -> (Rational, Rational) -> X ()

# Usage

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

    import XMonad
    import XMonad.Actions.UpdatePointer

Enable it by including it in your logHook definition, e.g.:

    logHook = updatePointer (0.5, 0.5) (1, 1)

which will move the pointer to the nearest point of a newly focused window. The first argument establishes a reference point within the newly-focused window, while the second argument linearly interpolates between said reference point and the edges of the newly-focused window to obtain a bounding box for the pointer.

    logHook = updatePointer (0.5, 0.5) (0, 0) -- exact centre of window
    logHook = updatePointer (0.25, 0.25) (0.25, 0.25) -- near the top-left
    logHook = updatePointer (0.5, 0.5) (1.1, 1.1) -- within 110% of the edge

To use this with an existing logHook, use >> :

    logHook = dynamicLog
              >> updatePointer (1, 1) (0, 0)

which moves the pointer to the bottom-right corner of the focused window.

updatePointer :: (Rational, Rational) -> (Rational, Rational) -> X () #

Update the pointer's location to the currently focused window or empty screen unless it's already there, or unless the user was changing focus with the mouse

See also `focusUnderPointer` for an inverse operation that updates the focus instead. The two can be combined in a single config if neither goes into `logHook` but are invoked explicitly in individual key bindings.