diff options
| author | Josh Rahm <rahm@google.com> | 2025-03-05 12:53:40 -0700 |
|---|---|---|
| committer | Josh Rahm <rahm@google.com> | 2025-03-05 12:53:40 -0700 |
| commit | 215182bbb8f3cf8e92b56371e24e1bc45ab22f88 (patch) | |
| tree | 766799f8bf8f74d9410e646eecf212fa26a17198 /src/Rahm/Desktop/Keys.hs | |
| parent | 47a0e6e471074b3816b6542c9421abbe33e1d468 (diff) | |
| download | rde-215182bbb8f3cf8e92b56371e24e1bc45ab22f88.tar.gz rde-215182bbb8f3cf8e92b56371e24e1bc45ab22f88.tar.bz2 rde-215182bbb8f3cf8e92b56371e24e1bc45ab22f88.zip | |
Ability to move multiple windows at once.
Diffstat (limited to 'src/Rahm/Desktop/Keys.hs')
| -rw-r--r-- | src/Rahm/Desktop/Keys.hs | 47 |
1 files changed, 29 insertions, 18 deletions
diff --git a/src/Rahm/Desktop/Keys.hs b/src/Rahm/Desktop/Keys.hs index b8647d6..61e483a 100644 --- a/src/Rahm/Desktop/Keys.hs +++ b/src/Rahm/Desktop/Keys.hs @@ -6,6 +6,7 @@ import Control.Monad unless, when, ) +import Control.Monad.Identity (Identity (Identity, runIdentity)) import Control.Monad.Trans.Maybe ( MaybeT (..), runMaybeT, @@ -142,7 +143,7 @@ import XMonad.Layout.Spacing ( Border (..), SpacingModifier (..), ) -import XMonad.Util.Run (safeSpawn, hPutStrLn, spawnPipe) +import XMonad.Util.Run (hPutStrLn, safeSpawn, spawnPipe) import XMonad.Util.WindowProperties import Prelude hiding ((!!)) @@ -1009,10 +1010,14 @@ bindings = do -- This allows me to make some pretty complex and powerful mappings with just -- the mouse by using button press sequences to mean different things. bind button1 $ do - justMod $ - doc + justMod + $ doc "Float and move a window" - myMouseMoveWindow + $ \win -> do + winSels <- getAndResetWindowSelection + if null winSels + then myMouseMoveWindow win + else myMouseMoveWindows winSels shiftMod $ doc @@ -1216,14 +1221,15 @@ bindings = do doc "Move all the windows to the workspace the pointer is on" $ noWindow $ do wins <- getAndResetWindowSelection - runMaybeT_ $ do - ws <- MaybeT pointerWorkspace - lift $ - let f = - appEndo - ( mconcat (map (Endo . W.shiftWin ws) wins) - ) - in windows f >> escape + D.mouseMoveWindowsAndThen + (mapM_ X.focus) + ( mconcat + [ D.ifReleased button1 D.sinkOnRelease, + D.ifReleased' button2 $ \w _ -> pinWindow w + ] + ) + wins + escape forM_ [(button7, ",.", "right"), (button6, ";.", "left")] $ \(b, mot, d) -> do @@ -1282,12 +1288,17 @@ bindings = do -- -- permuteMods = map (foldl' (.|.) 0) . filterM (const [True, False]) -myMouseMoveWindow = - D.mouseMoveWindowAndThen X.focus $ - mconcat - [ D.ifReleased button3 D.sinkOnRelease, - D.ifReleased' button2 $ \w _ -> X.killWindow w - ] +myMouseMoveWindow = myMouseMoveWindows . Identity + +myMouseMoveWindows :: (Foldable f) => f Window -> X () +myMouseMoveWindows = + D.mouseMoveWindowsAndThen + (mapM_ X.focus) + ( mconcat + [ D.ifReleased button3 D.sinkOnRelease, + D.ifReleased' button2 $ \w _ -> pinWindow w + ] + ) myMouseResizeAction = D.mouseResizeWindowAndThen X.focus $ |