mirror of
https://github.com/xmonad/xmonad-contrib.git
synced 2025-05-19 11:30:22 -07:00
Only move pointers over managed windows
This commit is contained in:
parent
9515818409
commit
9dae24bfd8
@ -25,6 +25,7 @@ module XMonad.Actions.UpdatePointer
|
|||||||
|
|
||||||
import XMonad
|
import XMonad
|
||||||
import Control.Monad
|
import Control.Monad
|
||||||
|
import XMonad.StackSet (member)
|
||||||
|
|
||||||
-- $usage
|
-- $usage
|
||||||
-- You can use this module with the following in your @~\/.xmonad\/xmonad.hs@:
|
-- You can use this module with the following in your @~\/.xmonad\/xmonad.hs@:
|
||||||
@ -56,13 +57,15 @@ data PointerPosition = Nearest | Relative Rational Rational
|
|||||||
-- focus with the mouse
|
-- focus with the mouse
|
||||||
updatePointer :: PointerPosition -> X ()
|
updatePointer :: PointerPosition -> X ()
|
||||||
updatePointer p = withFocused $ \w -> do
|
updatePointer p = withFocused $ \w -> do
|
||||||
|
ws <- gets windowset
|
||||||
dpy <- asks display
|
dpy <- asks display
|
||||||
root <- asks theRoot
|
root <- asks theRoot
|
||||||
mouseIsMoving <- asks mouseFocused
|
mouseIsMoving <- asks mouseFocused
|
||||||
wa <- io $ getWindowAttributes dpy w
|
wa <- io $ getWindowAttributes dpy w
|
||||||
(_sameRoot,_,_,rootx,rooty,_,_,_) <- io $ queryPointer dpy root
|
(_sameRoot,_,currentWindow,rootx,rooty,_,_,_) <- io $ queryPointer dpy root
|
||||||
unless (pointWithinRegion rootx rooty (wa_x wa) (wa_y wa) (wa_width wa) (wa_height wa)
|
unless (pointWithinRegion rootx rooty (wa_x wa) (wa_y wa) (wa_width wa) (wa_height wa)
|
||||||
|| mouseIsMoving) $
|
|| mouseIsMoving
|
||||||
|
|| not (currentWindow `member` ws)) $
|
||||||
case p of
|
case p of
|
||||||
Nearest -> do
|
Nearest -> do
|
||||||
let x = moveWithin rootx (wa_x wa) ((wa_x wa) + (wa_width wa))
|
let x = moveWithin rootx (wa_x wa) ((wa_x wa) + (wa_width wa))
|
||||||
|
Loading…
x
Reference in New Issue
Block a user