diff options
| author | Josh Rahm <joshuarahm@gmail.com> | 2022-04-10 13:26:16 -0600 |
|---|---|---|
| committer | Josh Rahm <joshuarahm@gmail.com> | 2022-10-09 12:19:46 -0600 |
| commit | a652c330707e2e9bbe963e01af79ce730cf3452e (patch) | |
| tree | 047655195f50efcbd51db8f825acf589dc6abead /src/Internal/SwapMaster.hs | |
| parent | 381a3e5a00813314249bb74b5460f5ff5a4006bb (diff) | |
| download | rde-a652c330707e2e9bbe963e01af79ce730cf3452e.tar.gz rde-a652c330707e2e9bbe963e01af79ce730cf3452e.tar.bz2 rde-a652c330707e2e9bbe963e01af79ce730cf3452e.zip | |
Rename Internal to Rahm.Desktop
Diffstat (limited to 'src/Internal/SwapMaster.hs')
| -rw-r--r-- | src/Internal/SwapMaster.hs | 41 |
1 files changed, 0 insertions, 41 deletions
diff --git a/src/Internal/SwapMaster.hs b/src/Internal/SwapMaster.hs deleted file mode 100644 index e7ade19..0000000 --- a/src/Internal/SwapMaster.hs +++ /dev/null @@ -1,41 +0,0 @@ -{- Swap window with the master, but save it. -} -module Internal.SwapMaster (swapMaster) where - -import qualified XMonad.StackSet as W - -import Internal.Windows (mapWindows, getMaster, swapWindows) -import Control.Monad.Trans.Maybe -import XMonad (Window, ExtensionClass(..), X(..), windows, windowset) -import Control.Monad (void) -import Control.Monad.Trans (lift) -import Data.Maybe (fromMaybe) -import Control.Monad.State (gets) - -import qualified XMonad.Util.ExtensibleState as XS - -newtype LastWindow = LastWindow { - lastWindow :: Maybe Window - } deriving (Show, Read) - -instance ExtensionClass LastWindow where - initialValue = LastWindow Nothing - -hoist :: (Monad m) => Maybe a -> MaybeT m a -hoist = MaybeT . return - -swapMaster :: X () -swapMaster = void $ runMaybeT $ do - ss <- gets windowset - - focused <- hoist $ W.peek ss - master <- hoist $ getMaster ss - - if focused == master - then do - lw <- MaybeT $ lastWindow <$> XS.get - lift $ windows (swapWindows focused lw) - else lift $ windows (swapWindows focused master) - - lift $ do - XS.put (LastWindow $ Just master) - windows W.focusMaster |