diff options
| author | Josh Rahm <rahm@google.com> | 2023-12-04 14:32:11 -0700 |
|---|---|---|
| committer | Josh Rahm <rahm@google.com> | 2023-12-04 14:32:11 -0700 |
| commit | ea291e76b2ab45e13f648e82b63c4668974c2eae (patch) | |
| tree | d1c44db24d3c3cc44aaf44e126f3636da6b4d547 /src/Rahm/Desktop/SwapMaster.hs | |
| parent | 2ab0c27e9864fd072275664ff13270c5e42ed1b6 (diff) | |
| download | rde-ea291e76b2ab45e13f648e82b63c4668974c2eae.tar.gz rde-ea291e76b2ab45e13f648e82b63c4668974c2eae.tar.bz2 rde-ea291e76b2ab45e13f648e82b63c4668974c2eae.zip | |
Add ability to swap two workspaces with the W command
Diffstat (limited to 'src/Rahm/Desktop/SwapMaster.hs')
| -rw-r--r-- | src/Rahm/Desktop/SwapMaster.hs | 14 |
1 files changed, 6 insertions, 8 deletions
diff --git a/src/Rahm/Desktop/SwapMaster.hs b/src/Rahm/Desktop/SwapMaster.hs index 68072a9..f95303d 100644 --- a/src/Rahm/Desktop/SwapMaster.hs +++ b/src/Rahm/Desktop/SwapMaster.hs @@ -26,16 +26,13 @@ import XMonad import qualified XMonad.Util.ExtensibleState as XS (get, modify, put) newtype LastWindow = LastWindow - { lastWindow :: Map String Window + { lastWindows :: Map String Window } deriving (Show, Read) instance ExtensionClass LastWindow where initialValue = LastWindow mempty -hoist :: (Monad m) => Maybe a -> MaybeT m a -hoist = MaybeT . return - swapMaster :: X () swapMaster = runMaybeT_ $ do @@ -49,7 +46,7 @@ swapMaster = return (a, b) lift $ do - st <- lastWindow <$> XS.get + st <- lastWindows <$> XS.get windows . W.swapWindows $ case focused == master of True @@ -58,7 +55,8 @@ swapMaster = False -> [(master, focused)] _ -> [] - XS.modify $ - \(LastWindow m) -> - LastWindow $ Map.insert (W.currentTag ss) master m + XS.modify $ mlw (Map.insert (W.currentTag ss) master) windows W.focusMaster + where + mlw fn (LastWindow l) = LastWindow (fn l) + hoist = MaybeT . return |