diff options
Diffstat (limited to 'src/Rahm/Desktop/Keys.hs')
| -rw-r--r-- | src/Rahm/Desktop/Keys.hs | 119 |
1 files changed, 107 insertions, 12 deletions
diff --git a/src/Rahm/Desktop/Keys.hs b/src/Rahm/Desktop/Keys.hs index fe96338..210d4c5 100644 --- a/src/Rahm/Desktop/Keys.hs +++ b/src/Rahm/Desktop/Keys.hs @@ -50,7 +50,7 @@ import Rahm.Desktop.Common runMaybeT_, setBorderColor, withBorderColor, - withBorderColorM, + withBorderColorM, pointerWorkspace, ) import Rahm.Desktop.DMenu (runDMenu) import qualified Rahm.Desktop.Dragging as D @@ -83,13 +83,19 @@ import Rahm.Desktop.Keys.Dsl (-|-), ) import Rahm.Desktop.Keys.Wml - ( gotoWorkspaceFn, + ( addWindowToSelection, + clearWindowSelection, + getAndResetWindowSelection, + gotoWorkspaceFn, moveWindowToWorkspaceFn, readNextLocationSet, + readNextLocationSet', readNextWorkspace, readNextWorkspaceName, readWindowsetMacro, readWorkspaceMacro, + removeWindowFromSelection, + toggleWindowInSelection, workspaceForString, workspaceForStringT, workspaceName, @@ -130,7 +136,8 @@ import Rahm.Desktop.RebindKeys ) import qualified Rahm.Desktop.StackSet as W import Rahm.Desktop.Submap - ( mapNextString, + ( escape, + mapNextString, submap, submapButtonsWithKey, ) @@ -290,7 +297,7 @@ keymap = runKeys $ do doc "Jump to a window" $ pushPendingBuffer "' " $ do runMaybeT_ $ do - l <- readNextLocationSet + l <- readNextLocationSet' case l of (h : _) -> lift (focusLocation h) _ -> return () @@ -567,6 +574,34 @@ keymap = runKeys $ do doc "For mosaic layout, shrink the size-share of the current window" $ sendMessage =<< shrinkPositionAlt + bind xK_n $ do + forM_ + [ ( justMod, + addWindowToSelection, + "Add a window set to the selection set", + "n " + ), + ( shiftMod, + removeWindowFromSelection, + "Remove a window set from the selection set", + "N " + ) + ] + $ \(m, fn, d, ch) -> do + m $ + doc d $ + pushPendingBuffer ch $ do + runMaybeT_ $ do + locset <- readNextLocationSet' + lift $ + forM_ locset $ \(Location _ mWin) -> + mapM_ fn mWin + + bind xK_period $ do + justMod $ + doc "Toggle the currently focused window in the selection set; (kinda) shorthand for Mod+n . ." $ + flip whenJust toggleWindowInSelection =<< withWindowSet (return . W.peek) + bind xK_m $ do justMod $ doc @@ -973,10 +1008,14 @@ mouseMap = runButtons $ do bind button1 $ do justMod $ - doc "Float and move a window" $ - \w -> - pushPendingBuffer "Dragging" $ - focus w >> mouseMoveWindow w >> windows W.shiftMaster + doc + "Float and move a window" + myMouseMoveWindow + + shiftMod $ + doc + "Add the currently focused window to the selection set." + toggleWindowInSelection bind button2 $ do justMod $ windows . (W.shiftMaster .) . W.focusWindow @@ -1117,10 +1156,66 @@ mouseMap = runButtons $ do doc "Jump to the last location." $ noWindow (click >> jumpToLastLocation) - bind button1 $ - noMod $ - doc "'drag' a workspace to another screen" $ - noWindow D.dragWorkspace + -- bind button1 $ + -- noMod $ + -- doc "'drag' a workspace to another screen" $ + -- noWindow D.dragWorkspace + + continuous $ do + bind button1 $ + noMod $ + doc + "add the window under the cursor to the window selection" + toggleWindowInSelection + + bind button2 $ + noMod $ + doc "Clear the window selection" (noWindow clearWindowSelection) + + bind button13 $ + noMod $ + doc "Kill the windows in the selection" $ + noWindow $ do + windows <- getAndResetWindowSelection + forM_ windows X.killWindow + escape + + bind button3 $ + noMod $ + 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 + + bind button15 $ noMod $ doc "" $ noWindow (return () :: X ()) + + forM_ [(button7, ",.", "right"), (button6, ";.", "left")] $ + \(b, mot, d) -> do + bind b $ + noMod $ + doc + ( "Move the selected windows to the workspace on the \ + \screen to the " + ++ d + ) + $ noWindow $ do + wins <- getAndResetWindowSelection + runMaybeT_ $ do + ws' <- workspaceForStringT mot + ws <- MaybeT . return $ workspaceName ws' + lift $ + let f = + appEndo + ( mconcat (map (Endo . W.shiftWin ws) wins) + ) + in windows f >> escape let workspaceButtons = [ ( button2, |