aboutsummaryrefslogtreecommitdiff
path: root/src/Rahm/Desktop/Layout.hs
diff options
context:
space:
mode:
authorJosh Rahm <joshuarahm@gmail.com>2022-04-13 00:22:08 -0600
committerJosh Rahm <joshuarahm@gmail.com>2022-10-09 12:19:46 -0600
commitcecacbf482f90d0ed56ce320fbb557b22cd3d7b0 (patch)
tree85fb4a94d2d3f8ea7b0802fc72fc7b7e78230879 /src/Rahm/Desktop/Layout.hs
parent85310f18ac936032ea8eb4e3e177684d2d738b7c (diff)
downloadrde-cecacbf482f90d0ed56ce320fbb557b22cd3d7b0.tar.gz
rde-cecacbf482f90d0ed56ce320fbb557b22cd3d7b0.tar.bz2
rde-cecacbf482f90d0ed56ce320fbb557b22cd3d7b0.zip
Add ConsistentMosaic, a wrapper to make Mosaic more consistent.
Right now, Mosaic operate on the windows itself. But this means that swapping windows can act very unintuitively. This wrapper changes mosaci to work on window /positions/ rather than windows themselves, so the window in position 1 will always be the same size, and when moved to position 2, it will inherit that position's size. There's still some buggy behavior, but it is in general much more intuitive than it was before.
Diffstat (limited to 'src/Rahm/Desktop/Layout.hs')
-rw-r--r--src/Rahm/Desktop/Layout.hs17
1 files changed, 9 insertions, 8 deletions
diff --git a/src/Rahm/Desktop/Layout.hs b/src/Rahm/Desktop/Layout.hs
index bd875d0..d8c3442 100644
--- a/src/Rahm/Desktop/Layout.hs
+++ b/src/Rahm/Desktop/Layout.hs
@@ -33,6 +33,7 @@ import Rahm.Desktop.Layout.Flip
import Rahm.Desktop.Layout.Rotate
import Rahm.Desktop.Layout.Redescribe
import Rahm.Desktop.Layout.Hole
+import Rahm.Desktop.Layout.ConsistentMosaic
import qualified Data.Map as M
import qualified XMonad.StackSet as W
@@ -50,7 +51,7 @@ mods =
myLayoutList =
layoutList $
mods (reinterpretIncMaster $ spiral (6/7)) |:
- mods (modifyMosaic (MosaicAlt M.empty :: MosaicAlt Window)) |:
+ mods (MosaicWrap $ modifyMosaic (MosaicAlt M.empty :: MosaicAlt Window)) |:
mods (reinterpretIncMaster $ Corner (3/4) (3/100)) |:
mods (Redescribe UsingTall (Tall 1 (3/100) (1/2))) |:
mods (Redescribe UsingThreeCol (ThreeCol 1 (3/100) (1/2))) |:
@@ -72,17 +73,17 @@ instance DoReinterpret "ForMosaic" where
-- IncMaster message
reinterpretMessage _ (fromMessage -> Just (IncMasterN n)) = do
- fmap (SomeMessage .
- (if n > 0
- then expandWindowAlt
- else shrinkWindowAlt)) <$> getFocusedWindow
+ Just . SomeMessage <$> (
+ if n > 0
+ then expandPositionAlt
+ else shrinkPositionAlt)
-- ResizeMaster message
reinterpretMessage _ (fromMessage -> Just m) = do
- fmap (SomeMessage .
+ Just . SomeMessage <$>
(case m of
- Expand -> expandWindowAlt
- Shrink -> shrinkWindowAlt)) <$> getFocusedWindow
+ Expand -> expandPositionAlt
+ Shrink -> shrinkPositionAlt)
-- Messages that don't match the above, just leave it unmodified.
reinterpretMessage _ m = return (Just m)