aboutsummaryrefslogtreecommitdiff
path: root/src/Internal/Layout.hs
diff options
context:
space:
mode:
authorJosh Rahm <rahm@google.com>2021-11-03 16:46:42 -0600
committerJosh Rahm <rahm@google.com>2021-11-03 16:46:42 -0600
commitf890f6d10158af006dda0be806813d4779cd1e89 (patch)
treeb694efac735e6cc94955d12d8ca6445e55a0b870 /src/Internal/Layout.hs
parente4d9cc1c22ba36516d24902c7f0de52b1009570b (diff)
downloadrde-f890f6d10158af006dda0be806813d4779cd1e89.tar.gz
rde-f890f6d10158af006dda0be806813d4779cd1e89.tar.bz2
rde-f890f6d10158af006dda0be806813d4779cd1e89.zip
Killed Dependency on Cairo. Vastly improved layout experience.
Diffstat (limited to 'src/Internal/Layout.hs')
-rw-r--r--src/Internal/Layout.hs51
1 files changed, 48 insertions, 3 deletions
diff --git a/src/Internal/Layout.hs b/src/Internal/Layout.hs
index 853a885..eb33a5e 100644
--- a/src/Internal/Layout.hs
+++ b/src/Internal/Layout.hs
@@ -13,6 +13,7 @@ import XMonad.Layout.ThreeColumns
import XMonad.Layout.Grid
import XMonad.Layout.Dishes
import XMonad.Layout.MosaicAlt
+import qualified XMonad.Layout.Dwindle as D
import XMonad.Layout
import XMonad.Layout.LayoutModifier
import XMonad
@@ -27,12 +28,56 @@ myLayout =
ModifiedLayout (HFlippable False) $
spacingRaw True (Border 5 5 5 5) True (Border 5 5 5 5) True $ avoidStruts $
spiral (6/7) |||
- Tall 1 (3/100) (1/2) |||
- ThreeCol 1 (3/100) (1/2) |||
+ ModifyDescription TallDescriptionModifier (Tall 1 (3/100) (1/2)) |||
+ ModifyDescription ThreeColDescMod (ThreeCol 1 (3/100) (1/2)) |||
Full |||
Grid |||
Dishes 2 (1/6) |||
- (MosaicAlt M.empty :: MosaicAlt Window)
+ (MosaicAlt M.empty :: MosaicAlt Window) |||
+ (D.Dwindle D.R D.CW 1.5 1.1)
+
+data ModifyDescription m l a = ModifyDescription m (l a)
+ deriving (Show, Read)
+
+data TallDescriptionModifier = TallDescriptionModifier
+ deriving (Show, Read)
+
+data ThreeColDescMod = ThreeColDescMod
+ deriving (Show, Read)
+
+class DescriptionModifier m l where
+ newDescription :: m -> l a -> String -> String
+
+instance (Show m, DescriptionModifier m l, LayoutClass l a) => LayoutClass (ModifyDescription m l) a where
+ runLayout (W.Workspace t (ModifyDescription m l) a) rect = do
+ (rects, maybeNewLayout) <- runLayout (W.Workspace t l a) rect
+ return (rects, fmap (ModifyDescription m) maybeNewLayout)
+
+ doLayout (ModifyDescription m l) a s = do
+ (rects, maybeNewLayout) <- doLayout l a s
+ return (rects, fmap (ModifyDescription m) maybeNewLayout)
+
+ pureLayout (ModifyDescription m l) a s = pureLayout l a s
+
+ emptyLayout (ModifyDescription m l) a = do
+ (rects, maybeNewLayout) <- emptyLayout l a
+ return (rects, fmap (ModifyDescription m) maybeNewLayout)
+
+ handleMessage (ModifyDescription m l) a = do
+ maybeNewLayout <- handleMessage l a
+ return (ModifyDescription m <$> maybeNewLayout)
+
+ pureMessage (ModifyDescription m l) a =
+ let maybeNewLayout = pureMessage l a in
+ ModifyDescription m <$> maybeNewLayout
+
+ description (ModifyDescription m l) = newDescription m l (description l)
+
+instance DescriptionModifier TallDescriptionModifier Tall where
+ newDescription _ (Tall mast _ _) _ = "Tall(" ++ show mast ++ ")"
+
+instance DescriptionModifier ThreeColDescMod ThreeCol where
+ newDescription _ (ThreeCol mast _ _) _ = "ThreeCol(" ++ show mast ++ ")"
data ResizeZoom = ShrinkZoom | ExpandZoom deriving (Typeable)