| xmonad-contrib-0.8.1: Third party extensions for xmonad | Source code | Contents | Index

XMonad.Actions.MouseGestures

Portability | unportable
Stability | unstable
Maintainer | <l.mai@web.de>

Contents

Usage

Description
Support for simple mouse gestures.
Synopsis

data Direction

= U
| D
| R
| L

mouseGestureH :: (Direction -> X ()) -> X () -> X ()
mouseGesture :: Map [Direction] (Window -> X ()) -> Window -> X ()
mkCollect :: (MonadIO m, MonadIO m') => m (Direction -> m' [Direction], m' [Direction])

Usage

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

     import XMonad.Actions.MouseGestures
     import qualified XMonad.StackSet as W

then add an appropriate mouse binding:

         , ((modMask x .|. shiftMask, button3), mouseGesture gestures)

where `gestures` is a `Map` from gestures to actions on windows, for example:

         gestures = M.fromList
             [ ([], focus)
             , ([U], \w -> focus w >> windows W.swapUp)
             , ([D], \w -> focus w >> windows W.swapDown)
             , ([R, D], \_ -> sendMessage NextLayout)
             ]

This is just an example, of course; you can use any mouse button and gesture definitions you want.

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

data Direction | Source

An enumeration of the four cardinal directions/sides of the screen. Ideally this would go in its own separate module in Util, but ManageDocks is angling for inclusion into the xmonad core, so keep the dependencies to a minimum.
Constructors

U | Up/top
D | Down/bottom
R | Right
L | Left

Instances

Bounded Direction
Enum Direction
Eq Direction
Ord Direction
Read Direction
Show Direction

mouseGestureH :: (Direction -> X ()) -> X () -> X () | Source

``mouseGestureH` moveHook endHook` is a mouse button event handler. It collects mouse movements, calling `moveHook` for each update; when the button is released, it calls `endHook`.

mouseGesture :: Map [Direction] (Window -> X ()) -> Window -> X () | Source

A utility function on top of `mouseGestureH`. It uses a `Map` to look up the mouse gesture, then executes the corresponding action (if any).

mkCollect :: (MonadIO m, MonadIO m') => m (Direction -> m' [Direction], m' [Direction]) | Source

A callback generator for `mouseGestureH`. `mkCollect` returns two callback functions for passing to `mouseGestureH`. The move hook will collect mouse movements (and return the current gesture as a list); the end hook will return a list of the completed gesture, which you can access with `>>=`.
Produced by Haddock version 2.4.2