diff options
| author | Josh Rahm <rahm@google.com> | 2025-03-06 15:27:01 -0700 |
|---|---|---|
| committer | Josh Rahm <rahm@google.com> | 2025-03-06 15:27:01 -0700 |
| commit | 61e8ccf2eab183587605cce4c5126258571b5294 (patch) | |
| tree | bf793e89bf4aa44d1459bd3db3dbf4a216c3675b /src/Rahm/Desktop/Keys | |
| parent | 1f66fa91b479946e9b4d172d88bbd5aa15676423 (diff) | |
| download | rde-61e8ccf2eab183587605cce4c5126258571b5294.tar.gz rde-61e8ccf2eab183587605cce4c5126258571b5294.tar.bz2 rde-61e8ccf2eab183587605cce4c5126258571b5294.zip | |
Rebrand WorkspaceSelect to "WorkspaceWheel"
Made the selector a wheel instead of a row. Added some keybindings and
button bindings.
Diffstat (limited to 'src/Rahm/Desktop/Keys')
| -rw-r--r-- | src/Rahm/Desktop/Keys/Wml.hs | 30 |
1 files changed, 17 insertions, 13 deletions
diff --git a/src/Rahm/Desktop/Keys/Wml.hs b/src/Rahm/Desktop/Keys/Wml.hs index 78f02c0..86bc921 100644 --- a/src/Rahm/Desktop/Keys/Wml.hs +++ b/src/Rahm/Desktop/Keys/Wml.hs @@ -21,6 +21,7 @@ module Rahm.Desktop.Keys.Wml moveLocationToWorkspace, moveWindowToWorkspaceFn, getAndResetWindowSelection, + getAndResetWindowSelectionOrCurrent, getWindowSelection, gotoWorkspaceFn, toggleWindowInSelection, @@ -66,15 +67,7 @@ import Data.List (find, intercalate, sortOn) import Data.List.Safe (head, last) import Data.Map (Map) import qualified Data.Map as Map - ( delete, - elems, - empty, - insert, - keys, - lookup, - member, - ) -import Data.Maybe (catMaybes, fromJust, fromMaybe) +import Data.Maybe (catMaybes, fromJust, fromMaybe, maybeToList) import Data.Ord (Down (..)) import Data.Typeable (cast) import Data.Void (Void, absurd) @@ -103,6 +96,7 @@ import Rahm.Desktop.Marking getMarkedLocations, windowLocation, ) +import Rahm.Desktop.StackSet (StackSet (current)) import qualified Rahm.Desktop.StackSet as W import Rahm.Desktop.Submap (mapNextStringWithKeysym) import Rahm.Desktop.Workspaces @@ -257,6 +251,17 @@ getAndResetWindowSelection = do XS.put (initialValue :: WindowSelect) return (Map.keys mp) +getAndResetWindowSelectionOrCurrent :: X [Window] +getAndResetWindowSelectionOrCurrent = do + (WindowSelect mp) <- XS.get + + if Map.null mp + then withWindowSet $ return . maybeToList . W.peek + else do + sequence_ (Map.elems mp) + XS.put (initialValue :: WindowSelect) + return (Map.keys mp) + data Workspace = forall a. (Typeable a) => Workspace @@ -584,7 +589,6 @@ readNextLocationSet' = -- A character is the base-case. Refers to a collection of windows. (_, _, [ch]) | isAlpha ch -> liftXToFeed $ getMarkedLocations [ch] - -- Goes to the most recent location in history. -- (_, _, "0") -> (: []) <$> MaybeT (fromX getMostRecentLocationInHistory) -- A Digit goes to the past history. @@ -618,8 +622,9 @@ readNextLocationSet' = hoistMaybeT $ mapM windowLocation =<< nonempty askWindowId -- All windows. - (_, _, "%") -> hoistMaybeT $ - mapM windowLocation =<< lift (withWindowSet (return . sortOn Down . W.allWindows)) + (_, _, "%") -> + hoistMaybeT $ + mapM windowLocation =<< lift (withWindowSet (return . sortOn Down . W.allWindows)) -- Windows in a workspace (_, _, s) | s == "\t" || s == "@" || s == "\n" -> @@ -664,5 +669,4 @@ readNextLocationSet' = l1 <- readNextLocationSet l2 <- readNextLocationSet return $ filter (`elem` l2) l1 - _ -> feedFail |