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

Copyright | (c) Lukas Mai
License | BSD3-style (see LICENSE)
Maintainer | <l.mai@web.de>
Stability | unstable
Portability | unportable
Safe Haskell | None
Language | Haskell2010

XMonad.Actions.MouseGestures

Contents

- Usage

Description

Support for simple mouse gestures.

Synopsis

- data Direction2D
  - = U
  - | D
  - | R
  - | L
- mouseGestureH :: (Direction2D -> X ()) -> X () -> X ()
- mouseGesture :: Map [Direction2D] (Window -> X ()) -> Window -> X ()
- mkCollect :: (MonadIO m, MonadIO m') => m (Direction2D -> m' [Direction2D], m' [Direction2D])

# Usage

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

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

then add an appropriate mouse binding:

        , ((modm .|. 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 Direction2D #

Two-dimensional directions:

Constructors

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

#### Instances

Instances details

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

Instance details

Defined in XMonad.Util.Types

Methods

succ :: Direction2D -> Direction2D #

pred :: Direction2D -> Direction2D #

toEnum :: Int -> Direction2D #

fromEnum :: Direction2D -> Int #

enumFrom :: Direction2D -> [Direction2D] #

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

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

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

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

mouseGestureH :: (Direction2D -> X ()) -> X () -> X () #

``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 [Direction2D] (Window -> X ()) -> Window -> X () #

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 (Direction2D -> m' [Direction2D], m' [Direction2D]) #

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