diff options
author | Brent Yorgey <byorgey@gmail.com> | 2007-11-27 20:37:17 +0100 |
---|---|---|
committer | Brent Yorgey <byorgey@gmail.com> | 2007-11-27 20:37:17 +0100 |
commit | ef3313d9b698172a8d81cea7b4fd74878c6b6709 (patch) | |
tree | 59ed4efa22cf7a4ae667c40fb64409711e296b49 /XMonad/Actions | |
parent | 7049a94f71d36513df832f70b7f2b49671bff2a1 (diff) | |
download | XMonadContrib-ef3313d9b698172a8d81cea7b4fd74878c6b6709.tar.gz XMonadContrib-ef3313d9b698172a8d81cea7b4fd74878c6b6709.tar.xz XMonadContrib-ef3313d9b698172a8d81cea7b4fd74878c6b6709.zip |
Warp: haddock updates
darcs-hash:20071127193717-bd4d7-4dfd41ff076c194926210900f4b83dc3a01ccb3d.gz
Diffstat (limited to 'XMonad/Actions')
-rw-r--r-- | XMonad/Actions/Warp.hs | 35 |
1 files changed, 18 insertions, 17 deletions
diff --git a/XMonad/Actions/Warp.hs b/XMonad/Actions/Warp.hs index bc7bacc..4f3bd5c 100644 --- a/XMonad/Actions/Warp.hs +++ b/XMonad/Actions/Warp.hs @@ -3,20 +3,19 @@ -- Module : XMonad.Actions.Warp -- Copyright : (c) daniel@wagner-home.com -- License : BSD3-style (see LICENSE) --- +-- -- Maintainer : daniel@wagner-home.com -- Stability : unstable -- Portability : unportable -- --- This can be used to make a keybinding that warps the pointer to a given --- window or screen. +-- Warp the pointer to a given window or screen. -- ----------------------------------------------------------------------------- module XMonad.Actions.Warp ( -- * Usage -- $usage - warpToScreen, + warpToScreen, warpToWindow ) where @@ -30,26 +29,24 @@ import XMonad import XMonad.StackSet as W {- $usage -This can be used to make a keybinding that warps the pointer to a given -window or screen. For example, I've added the following keybindings to -my Config.hs: +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: -> , ((modMask, xK_z ), warpToWindow (1%2) (1%2)) -- @@ Move pointer to currently focused window -> +> , ((modMask x, 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 -> -> [((modMask .|. controlMask, key), warpToScreen sc (1%2) (1%2)) +> +> [((modMask x .|. 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. -} --- %import XMonad.Actions.Warp --- %keybind , ((modMask, xK_z ), warpToWindow (1%2) (1%2)) -- @@ Move pointer to currently focused window --- %keybindlist ++ --- %keybindlist -- mod-ctrl-{w,e,r} @@ Move mouse pointer to screen 1, 2, or 3 --- %keybindlist [((modMask .|. controlMask, key), warpToScreen sc (1%2) (1%2)) --- %keybindlist | (key, sc) <- zip [xK_w, xK_e, xK_r] [0..]] +-- For detailed instructions on editing your key bindings, see +-- "XMonad.Doc.Extending#Editing_key_bindings". fraction :: (Integral a, Integral b) => Rational -> a -> b fraction f x = floor (f * fromIntegral x) @@ -57,6 +54,8 @@ fraction f x = floor (f * fromIntegral x) warp :: Window -> Position -> Position -> X () warp w x y = withDisplay $ \d -> io $ warpPointer d none w 0 0 0 0 x y +-- | Warp the pointer to a given position relative to the currently +-- focused window. Top left = (0,0), bottom right = (1,1). warpToWindow :: Rational -> Rational -> X () warpToWindow h v = withDisplay $ \d -> @@ -64,6 +63,8 @@ warpToWindow h v = wa <- io $ getWindowAttributes d w warp w (fraction h (wa_width wa)) (fraction v (wa_height wa)) +-- | Warp the pointer to the given position (top left = (0,0), bottom +-- right = (1,1)) on the given screen. warpToScreen :: ScreenId -> Rational -> Rational -> X () warpToScreen n h v = do root <- asks theRoot |