aboutsummaryrefslogtreecommitdiff
path: root/src/Internal/Layout.hs
diff options
context:
space:
mode:
authorJosh Rahm <joshuarahm@gmail.com>2022-04-09 22:39:30 -0600
committerJosh Rahm <joshuarahm@gmail.com>2022-04-09 23:53:57 -0600
commit3249935394c85cc9ca25d6bbbd74da002d43dccf (patch)
tree0faf7651c1432dddb039a3c0dd96eb413034e5b5 /src/Internal/Layout.hs
parente5a0476248e0f24cd335e88e933ac4affc19aa8d (diff)
downloadrde-3249935394c85cc9ca25d6bbbd74da002d43dccf.tar.gz
rde-3249935394c85cc9ca25d6bbbd74da002d43dccf.tar.bz2
rde-3249935394c85cc9ca25d6bbbd74da002d43dccf.zip
Rename LayoutZipper to LayoutList. Add more utils for handling a selector
Diffstat (limited to 'src/Internal/Layout.hs')
-rw-r--r--src/Internal/Layout.hs22
1 files changed, 17 insertions, 5 deletions
diff --git a/src/Internal/Layout.hs b/src/Internal/Layout.hs
index 562f947..6c78c70 100644
--- a/src/Internal/Layout.hs
+++ b/src/Internal/Layout.hs
@@ -25,7 +25,7 @@ import XMonad
import XMonad.Core
import XMonad.Layout.NoBorders (smartBorders, noBorders)
-import Internal.LayoutZipper
+import Internal.LayoutList
import Internal.Windows
import qualified Data.Map as M
@@ -36,9 +36,9 @@ myLayout =
avoidStruts $
spacingRaw True (Border 5 5 5 5) True (Border 5 5 5 5) True $
layoutZipper $
- mods (spiral (6/7)) |:
+ mods (reinterpretIncMaster $ spiral (6/7)) |:
mods (modifyMosaic (MosaicAlt M.empty :: MosaicAlt Window)) |:
- mods (Corner (3/4) (3/100)) |:
+ mods (reinterpretIncMaster $ Corner (3/4) (3/100)) |:
mods (ModifyDescription TallDescriptionModifier (Tall 1 (3/100) (1/2))) |:
mods (ModifyDescription ThreeColDescMod (ThreeCol 1 (3/100) (1/2))) |:
mods Grid |:
@@ -69,14 +69,14 @@ instance DoReinterpret "ForMosaic" where
-- IncMaster message
reinterpretMessage _ (fromMessage -> Just (IncMasterN n)) = do
- (fmap $ SomeMessage .
+ fmap (SomeMessage .
(if n > 0
then expandWindowAlt
else shrinkWindowAlt)) <$> getFocusedWindow
-- ResizeMaster message
reinterpretMessage _ (fromMessage -> Just m) = do
- (fmap $ SomeMessage .
+ fmap (SomeMessage .
(case m of
Expand -> expandWindowAlt
Shrink -> shrinkWindowAlt)) <$> getFocusedWindow
@@ -84,6 +84,14 @@ instance DoReinterpret "ForMosaic" where
-- Messages that don't match the above, just leave it unmodified.
reinterpretMessage _ m = return (Just m)
+instance DoReinterpret "IncMasterToResizeMaster" where
+ reinterpretMessage _ (fromMessage -> Just (IncMasterN n)) =
+ return $ Just $
+ if n > 0
+ then SomeMessage Expand
+ else SomeMessage Shrink
+ reinterpretMessage _ m = return (Just m)
+
-- Data construct for association a DoReinterpret function with a concrete
-- construct that can be used in the LayoutModifier instance.
--
@@ -117,6 +125,10 @@ instance (DoReinterpret k) =>
modifyMosaic :: l a -> ModifiedLayout (ReinterpretMessage "ForMosaic") l a
modifyMosaic = ModifiedLayout ReinterpretMessage
+reinterpretIncMaster ::
+ l a -> ModifiedLayout (ReinterpretMessage "IncMasterToResizeMaster") l a
+reinterpretIncMaster = ModifiedLayout ReinterpretMessage
+
mods =
ModifiedLayout (Zoomable False 0.05 0.05) .
ModifiedLayout (Flippable False) .