aboutsummaryrefslogtreecommitdiffstats
path: root/XMonad/Actions/FloatSnap.hs
diff options
context:
space:
mode:
authorankaan <ankaan@gmail.com>2015-03-06 18:17:02 +0100
committerankaan <ankaan@gmail.com>2015-03-06 18:17:02 +0100
commit90fa406833c7158525e6ff4f941a85abf2dabd9b (patch)
tree76c635a8a3ac075fe3633154f579754620577878 /XMonad/Actions/FloatSnap.hs
parentdcb29816dd1627411028aa05e2331f3e8050e5ff (diff)
downloadXMonadContrib-90fa406833c7158525e6ff4f941a85abf2dabd9b.tar.gz
XMonadContrib-90fa406833c7158525e6ff4f941a85abf2dabd9b.tar.xz
XMonadContrib-90fa406833c7158525e6ff4f941a85abf2dabd9b.zip
X.L.AvoidFloats, like avoidStruts but for floats
Ignore-this: 3722d7787dd2429313f92f85f3ae1251 Checks for floating windows within the layout area and finds a maximum area rectangle within that does not overlap with any of the floating windows. This rectangle is used for all non-floating windows. This new functionality introduced problems with the recommended configuration of one of my other modules (X.A.FloatSnap.) A new and more reliable method of distinguishing between clicks and drags where therefore introduced in the new module X.A.AfterDrag. This does not break any prior use of FloatSnap, but will require changes in configuration if used together with AvoidFloats. (This is mentioned in the docs for AvoidFloats and I recommend using the new configuration method even if AvoidFloats is not in use.) darcs-hash:20150306171702-3948e-a8b8c75ba49306a33d87c9414117f8a49c536dbf.gz
Diffstat (limited to '')
-rw-r--r--XMonad/Actions/FloatSnap.hs26
1 files changed, 18 insertions, 8 deletions
diff --git a/XMonad/Actions/FloatSnap.hs b/XMonad/Actions/FloatSnap.hs
index 3597254..baf511f 100644
--- a/XMonad/Actions/FloatSnap.hs
+++ b/XMonad/Actions/FloatSnap.hs
@@ -21,18 +21,21 @@ module XMonad.Actions.FloatSnap (
snapShrink,
snapMagicMove,
snapMagicResize,
- snapMagicMouseResize) where
+ snapMagicMouseResize,
+ afterDrag,
+ ifClick,
+ ifClick') where
import XMonad
import Control.Applicative((<$>))
import Data.List (sort)
import Data.Maybe (listToMaybe,fromJust,isNothing)
import qualified XMonad.StackSet as W
+import qualified Data.Set as S
import XMonad.Hooks.ManageDocks (calcGap)
import XMonad.Util.Types (Direction2D(..))
-
-import qualified Data.Set as S
+import XMonad.Actions.AfterDrag
-- $usage
-- You can use this module with the following in your @~\/.xmonad\/xmonad.hs@:
@@ -53,17 +56,24 @@ import qualified Data.Set as S
-- For detailed instructions on editing your key bindings, see
-- "XMonad.Doc.Extending#Editing_key_bindings".
--
--- And possibly add an appropriate mouse binding, for example:
+-- And possibly add appropriate mouse bindings, for example:
--
--- > , ((modm, button1), (\w -> focus w >> mouseMoveWindow w >> snapMagicMove (Just 50) (Just 50) w))
--- > , ((modm .|. shiftMask, button1), (\w -> focus w >> mouseMoveWindow w >> snapMagicResize [L,R,U,D] (Just 50) (Just 50) w))
--- > , ((modm, button3), (\w -> focus w >> mouseResizeWindow w >> snapMagicResize [R,D] (Just 50) (Just 50) w))
+-- > , ((modm, button1), (\w -> focus w >> mouseMoveWindow w >> ifClick (snapMagicMove (Just 50) (Just 50) w)))
+-- > , ((modm .|. shiftMask, button1), (\w -> focus w >> mouseMoveWindow w >> ifClick (snapMagicResize [L,R,U,D] (Just 50) (Just 50) w)))
+-- > , ((modm, button3), (\w -> focus w >> mouseResizeWindow w >> ifClick (snapMagicResize [R,D] (Just 50) (Just 50) w)))
--
-- For detailed instructions on editing your mouse bindings, see
-- "XMonad.Doc.Extending#Editing_mouse_bindings".
--
-- Using these mouse bindings, it will not snap while moving, but allow you to click the window once after it has been moved or resized to snap it into place.
--- Note that the order in which the commands are applied in the mouse bindings are important.
+-- Note that the order in which the commands are applied in the mouse bindings are important. Snapping can also be used together with other window resizing
+-- functions, such as those from "XMonad.Actions.FlexibleResize"
+--
+-- An alternative set of mouse bindings that will always snap after the drag is:
+--
+-- > , ((modm, button1), (\w -> focus w >> mouseMoveWindow w >> afterDrag (snapMagicMove (Just 50) (Just 50) w)))
+-- > , ((modm .|. shiftMask, button1), (\w -> focus w >> mouseMoveWindow w >> afterDrag (snapMagicResize [L,R,U,D] (Just 50) (Just 50) w)))
+-- > , ((modm, button3), (\w -> focus w >> mouseResizeWindow w >> afterDrag (snapMagicResize [R,D] (Just 50) (Just 50) w)))
--
-- Interesting values for the distance to look for window in the orthogonal axis are Nothing (to snap against every window), Just 0 (to only snap
-- against windows that we should collide with geometrically while moving) and Just 1 (to also snap against windows we brush against).