diff options
| author | Josh Rahm <joshuarahm@gmail.com> | 2022-04-11 22:58:45 -0600 |
|---|---|---|
| committer | Josh Rahm <joshuarahm@gmail.com> | 2022-10-09 12:19:46 -0600 |
| commit | 106695b521dedb23e314d94ba9a87e7c2e142a37 (patch) | |
| tree | 760d74abbb4f59cf725673d488957ea8fa7bcbeb /src/Rahm/Desktop/Layout/Layout.hs | |
| parent | 45fcba1681f4fda4f4ed380f00a8b6fbea681a59 (diff) | |
| download | rde-106695b521dedb23e314d94ba9a87e7c2e142a37.tar.gz rde-106695b521dedb23e314d94ba9a87e7c2e142a37.tar.bz2 rde-106695b521dedb23e314d94ba9a87e7c2e142a37.zip | |
Rename Zoom to Pop and move into its own Module.
Much cleaner.
Diffstat (limited to 'src/Rahm/Desktop/Layout/Layout.hs')
| -rw-r--r-- | src/Rahm/Desktop/Layout/Layout.hs | 60 |
1 files changed, 2 insertions, 58 deletions
diff --git a/src/Rahm/Desktop/Layout/Layout.hs b/src/Rahm/Desktop/Layout/Layout.hs index 93228e7..fd34c33 100644 --- a/src/Rahm/Desktop/Layout/Layout.hs +++ b/src/Rahm/Desktop/Layout/Layout.hs @@ -27,6 +27,7 @@ import Rahm.Desktop.Layout.CornerLayout (Corner(..)) import Rahm.Desktop.Layout.LayoutList import Rahm.Desktop.Windows import Rahm.Desktop.Layout.ReinterpretMessage +import Rahm.Desktop.Layout.Pop import qualified Data.Map as M import qualified XMonad.StackSet as W @@ -87,7 +88,7 @@ reinterpretIncMaster :: reinterpretIncMaster = ModifiedLayout ReinterpretMessage mods = - ModifiedLayout (Zoomable False 0.05 0.05) . + poppable . ModifiedLayout (Flippable False) . ModifiedLayout (HFlippable False) . ModifiedLayout (Rotateable False) @@ -137,10 +138,6 @@ instance DescriptionModifier ThreeColDescMod ThreeCol where newDescription _ (ThreeCol mast _ _) _ = "ThreeCol(" ++ show mast ++ ")" newDescription _ (ThreeColMid mast _ _) _ = "ThreeColMid(" ++ show mast ++ ")" -data ResizeZoom = ShrinkZoom | ExpandZoom deriving (Typeable) - -instance Message ResizeZoom where - newtype Flippable a = Flippable Bool -- True if flipped deriving (Show, Read) @@ -156,23 +153,10 @@ data HFlipLayout = HFlipLayout deriving (Typeable) data DoRotate = DoRotate deriving (Typeable) -data Zoomable a = Zoomable Bool Float Float -- True if zooming in on the focused window. - deriving (Show, Read) - --- Toggles if the current window should be zoomed or not. Set the boolean --- to set the zoom.mhar -data ZoomModifier = - ToggleZoom | - Zoom | - Unzoom - deriving (Typeable) - instance Message FlipLayout where instance Message HFlipLayout where -instance Message ZoomModifier where - instance Message DoRotate where instance (Eq a) => LayoutModifier Rotateable a where @@ -241,43 +225,3 @@ instance (Eq a) => LayoutModifier HFlippable a where if flipped then descr ++ " HFlipped" else descr - - -instance (Eq a) => LayoutModifier Zoomable a where - redoLayout (Zoomable doit ws hs) (Rectangle x y w h) stack returned = - if doit - then - let focused = W.focus <$> stack - (zoomed, rest) = partition ((==focused) . Just . fst) returned - in case zoomed of - [] -> return (rest, Nothing) - ((fwin, _):_) -> return ((fwin, Rectangle (x + wp) (y + hp) (w - fromIntegral (wp * 2)) (h - fromIntegral (hp * 2))) : rest, Nothing) - - else return (returned, Nothing) - where - wp = floor $ fromIntegral w * ws - hp = floor $ fromIntegral h * hs - - handleMessOrMaybeModifyIt self@(Zoomable showing sw sh) mess = - return $ - (handleResize <$> fromMessage mess) - <|> (Left . handleZoom <$> fromMessage mess) - where - handleResize r = - if showing - then Left $ Zoomable showing (guard $ sw + d) (guard $ sh + d) - else Right $ case r of - ShrinkZoom -> SomeMessage Shrink - ExpandZoom -> SomeMessage Expand - - where d = (case r of - ShrinkZoom -> -1 - ExpandZoom -> 1) * 0.02 - - handleZoom ToggleZoom = Zoomable (not showing) sw sh - handleZoom Zoom = Zoomable True sw sh - handleZoom Unzoom = Zoomable False sw sh - - guard f | f > 1 = 1 - | f < 0 = 0 - | otherwise = f |