diff options
author | Brent Yorgey <byorgey@gmail.com> | 2007-11-24 18:33:51 +0100 |
---|---|---|
committer | Brent Yorgey <byorgey@gmail.com> | 2007-11-24 18:33:51 +0100 |
commit | 4c36a8cd0f807dc7e8f9d0eaedb9092d7a18d154 (patch) | |
tree | 84984ad67c7d419a1d1be0f7943999ee000b3815 /XMonad | |
parent | bcef2910ddbfd253db0c1d7092f7b8fa847536ec (diff) | |
download | XMonadContrib-4c36a8cd0f807dc7e8f9d0eaedb9092d7a18d154.tar.gz XMonadContrib-4c36a8cd0f807dc7e8f9d0eaedb9092d7a18d154.tar.xz XMonadContrib-4c36a8cd0f807dc7e8f9d0eaedb9092d7a18d154.zip |
MouseGestures: haddock updates
darcs-hash:20071124173351-bd4d7-eb115b38e84768ff001810e51c447d6b953c4c11.gz
Diffstat (limited to 'XMonad')
-rw-r--r-- | XMonad/Actions/MouseGestures.hs | 34 |
1 files changed, 23 insertions, 11 deletions
diff --git a/XMonad/Actions/MouseGestures.hs b/XMonad/Actions/MouseGestures.hs index 32d7e60..f57f6a7 100644 --- a/XMonad/Actions/MouseGestures.hs +++ b/XMonad/Actions/MouseGestures.hs @@ -3,12 +3,12 @@ -- Module : XMonad.Actions.MouseGestures -- Copyright : (c) Lukas Mai -- License : BSD3-style (see LICENSE) --- +-- -- Maintainer : <l.mai@web.de> -- Stability : unstable -- Portability : unportable -- --- Support for simple mouse gestures +-- Support for simple mouse gestures. -- ----------------------------------------------------------------------------- @@ -32,15 +32,19 @@ import Data.Map (Map) import System.IO -- $usage --- In your Config.hs: -- --- > import XMonad.Actions.MouseGestures --- > ... --- > mouseBindings = M.fromList $ --- > [ ... --- > , ((modMask .|. shiftMask, button3), mouseGesture gestures) --- > ] --- > where +-- You can use this module with the following in your @~\/.xmonad\/xmonad.hs@: +-- +-- > import XMonad.Actions.Commands +-- > import qualified XMonad.StackSet as W +-- +-- then add an appropriate mouse binding: +-- +-- > , ((modMask x .|. shiftMask, button3), mouseGesture gestures) +-- +-- where @gestures@ is a 'Data.Map.Map' from gestures to actions on +-- windows, for example: +-- -- > gestures = M.fromList -- > [ ([], focus) -- > , ([U], \w -> focus w >> windows W.swapUp) @@ -48,9 +52,14 @@ import System.IO -- > , ([R, D], \_ -> sendMessage NextLayout) -- > ] -- --- This is just an example, of course. You can use any mouse button and +-- 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#Editing_mouse_bindings". +-- | The four cardinal screen directions. A \"gesture\" is a sequence of +-- directions. data Direction = L | U | R | D deriving (Eq, Ord, Show, Read, Enum, Bounded) @@ -99,6 +108,9 @@ collect st nx ny = do extract :: (Pos, [(Direction, Pos, Pos)]) -> [Direction] extract (_, xs) = reverse . map (\(x, _, _) -> x) $ xs +-- | Given a 'Data.Map.Map' from lists of directions to actions with +-- windows, figure out which one the user is performing, and return +-- the corresponding action. mouseGesture :: Map [Direction] (Window -> X ()) -> Window -> X () mouseGesture tbl win = withDisplay $ \dpy -> do root <- asks theRoot |