diff options
| author | Josh Rahm <joshuarahm@gmail.com> | 2022-04-12 01:04:05 -0600 |
|---|---|---|
| committer | Josh Rahm <joshuarahm@gmail.com> | 2022-10-09 12:19:46 -0600 |
| commit | bb05b03906a60b1a4a87a454b750a698cda913e3 (patch) | |
| tree | f393b7be352b8c6f6b642128b840797de9c56be8 /src/Rahm/Desktop/Layout | |
| parent | bc1f9daeac09beb20a2c587d259048aea3b03176 (diff) | |
| download | rde-bb05b03906a60b1a4a87a454b750a698cda913e3.tar.gz rde-bb05b03906a60b1a4a87a454b750a698cda913e3.tar.bz2 rde-bb05b03906a60b1a4a87a454b750a698cda913e3.zip | |
Break out the ModifyDescription into its own file.
Diffstat (limited to 'src/Rahm/Desktop/Layout')
| -rw-r--r-- | src/Rahm/Desktop/Layout/Layout.hs | 50 |
1 files changed, 8 insertions, 42 deletions
diff --git a/src/Rahm/Desktop/Layout/Layout.hs b/src/Rahm/Desktop/Layout/Layout.hs index 88143cd..2719bea 100644 --- a/src/Rahm/Desktop/Layout/Layout.hs +++ b/src/Rahm/Desktop/Layout/Layout.hs @@ -10,6 +10,7 @@ import XMonad.Layout.Accordion import Control.Applicative import XMonad.Layout.Spacing import Data.List +import Data.Typeable (cast) import XMonad.Layout.Spiral import XMonad.Layout.ThreeColumns import XMonad.Layout.Grid @@ -30,6 +31,7 @@ import Rahm.Desktop.Layout.ReinterpretMessage import Rahm.Desktop.Layout.Pop import Rahm.Desktop.Layout.Flip import Rahm.Desktop.Layout.Rotate +import Rahm.Desktop.Layout.Redescribe import qualified Data.Map as M import qualified XMonad.StackSet as W @@ -44,8 +46,8 @@ myLayout = mods (reinterpretIncMaster $ spiral (6/7)) |: mods (modifyMosaic (MosaicAlt M.empty :: MosaicAlt Window)) |: 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 (Redescribe UsingTall (Tall 1 (3/100) (1/2))) |: + mods (Redescribe UsingThreeCol (ThreeCol 1 (3/100) (1/2))) |: mods Grid |: mods (Dishes 2 (1/6)) |: mods (reinterpretIncMaster $ D.Dwindle D.R D.CW 1.5 1.1) |: @@ -91,47 +93,11 @@ reinterpretIncMaster :: l a -> ModifiedLayout (ReinterpretMessage "IncMasterToResizeMaster") l a reinterpretIncMaster = ModifiedLayout ReinterpretMessage - -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 (Typeable m, 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 +data UsingTall = UsingTall deriving (Read, Show) +instance Describer UsingTall Tall where newDescription _ (Tall mast _ _) _ = "Tall(" ++ show mast ++ ")" -instance DescriptionModifier ThreeColDescMod ThreeCol where +data UsingThreeCol = UsingThreeCol deriving (Read, Show) +instance Describer UsingThreeCol ThreeCol where newDescription _ (ThreeCol mast _ _) _ = "ThreeCol(" ++ show mast ++ ")" newDescription _ (ThreeColMid mast _ _) _ = "ThreeColMid(" ++ show mast ++ ")" |