aboutsummaryrefslogtreecommitdiff
path: root/src/Rahm/Desktop/SwapMaster.hs
diff options
context:
space:
mode:
Diffstat (limited to 'src/Rahm/Desktop/SwapMaster.hs')
-rw-r--r--src/Rahm/Desktop/SwapMaster.hs14
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