aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJosh Rahm <rahm@google.com>2022-04-12 12:19:02 -0600
committerJosh Rahm <joshuarahm@gmail.com>2022-10-09 12:19:46 -0600
commitbaf56fd0bd78fcbd60086858ab65d2688e0d2709 (patch)
treeae70e667a69300b11d1897e1ec03907694db913a
parent31b5e57b18bab46896d825248319a8387fac3b7c (diff)
downloadrde-baf56fd0bd78fcbd60086858ab65d2688e0d2709.tar.gz
rde-baf56fd0bd78fcbd60086858ab65d2688e0d2709.tar.bz2
rde-baf56fd0bd78fcbd60086858ab65d2688e0d2709.zip
Clean up LayoutList and move to Layout.List
-rw-r--r--src/Rahm/Desktop/Keys.hs2
-rw-r--r--src/Rahm/Desktop/Layout.hs4
-rw-r--r--src/Rahm/Desktop/Layout/List.hs (renamed from src/Rahm/Desktop/Layout/LayoutList.hs)25
3 files changed, 8 insertions, 23 deletions
diff --git a/src/Rahm/Desktop/Keys.hs b/src/Rahm/Desktop/Keys.hs
index 27de459..87f88cf 100644
--- a/src/Rahm/Desktop/Keys.hs
+++ b/src/Rahm/Desktop/Keys.hs
@@ -45,7 +45,6 @@ import XMonad.Actions.SpawnOn as SpawnOn
import qualified Data.Map as Map
import qualified XMonad.StackSet as W
-import Rahm.Desktop.Layout.LayoutList
import Rahm.Desktop.MouseMotion
import Rahm.Desktop.Windows
import Rahm.Desktop.Lib
@@ -54,6 +53,7 @@ import Rahm.Desktop.PassMenu
import Rahm.Desktop.Logger
import Rahm.Desktop.RebindKeys
import Rahm.Desktop.Swallow
+import Rahm.Desktop.Layout.List (toNextLayout, toPreviousLayout, toFirstLayout)
import Rahm.Desktop.Layout.Hole (toggleHole)
import Rahm.Desktop.Layout.Pop (togglePop)
import Rahm.Desktop.Layout.Flip (flipHorizontally, flipVertically)
diff --git a/src/Rahm/Desktop/Layout.hs b/src/Rahm/Desktop/Layout.hs
index aeceff9..b416111 100644
--- a/src/Rahm/Desktop/Layout.hs
+++ b/src/Rahm/Desktop/Layout.hs
@@ -25,7 +25,7 @@ import XMonad.Core
import XMonad.Layout.NoBorders (smartBorders, noBorders)
import Rahm.Desktop.Layout.CornerLayout (Corner(..))
-import Rahm.Desktop.Layout.LayoutList
+import Rahm.Desktop.Layout.List
import Rahm.Desktop.Windows
import Rahm.Desktop.Layout.ReinterpretMessage
import Rahm.Desktop.Layout.Pop
@@ -44,7 +44,7 @@ mods =
myLayout =
fullscreenFull $
avoidStruts $
- layoutZipper $
+ layoutList $
mods (reinterpretIncMaster $ spiral (6/7)) |:
mods (modifyMosaic (MosaicAlt M.empty :: MosaicAlt Window)) |:
mods (reinterpretIncMaster $ Corner (3/4) (3/100)) |:
diff --git a/src/Rahm/Desktop/Layout/LayoutList.hs b/src/Rahm/Desktop/Layout/List.hs
index 3e72e99..96f9be5 100644
--- a/src/Rahm/Desktop/Layout/LayoutList.hs
+++ b/src/Rahm/Desktop/Layout/List.hs
@@ -7,9 +7,9 @@
- The indexing uses a type-safe zipper to keep track of the currently-selected
- layout.
-}
-module Rahm.Desktop.Layout.LayoutList (
+module Rahm.Desktop.Layout.List (
LayoutList,
- layoutZipper,
+ layoutList,
LCons,
LNil,
toNextLayout,
@@ -156,6 +156,7 @@ data LayoutList l a where
deriving instance (LayoutSelect l a) => Show (LayoutList l a)
deriving instance (LayoutSelect l a) => Read (LayoutList l a)
+-- Cons two LayoutSelect types together.
(|:) :: (LayoutSelect t a, LayoutClass l a) => l a -> t a -> LCons l t a
(|:) = LCons
@@ -164,9 +165,9 @@ infixr 5 |:
-- Constructs a LayoutList. This function enforces that the SelectorFor l
-- is a 'Sel' type. Essentially this enforces that there must be at least one
-- underlying layout, otherwise a LayoutList cannot be constructed.
-layoutZipper :: (LayoutSelect l a, SelectorFor l ~ Sel n) =>
+layoutList :: (LayoutSelect l a, SelectorFor l ~ Sel n) =>
l a -> LayoutList l a
-layoutZipper = LayoutList Sel
+layoutList = LayoutList Sel
-- The termination of a layout zipper.
nil :: LNil a
@@ -264,18 +265,6 @@ instance (Show (l a), Typeable l, LayoutSelect l a) =>
Nothing -> return ([], Nothing)
Just (r, la) -> return (r, Just (LayoutList idx la))
- pureLayout (LayoutList idx l) r s = runIdentity $ do
- r <- update idx l $ \layout -> return (pureLayout layout r s, Nothing)
- case r of
- Nothing -> return []
- Just (r, a) -> return r
-
- emptyLayout (LayoutList idx l) r = do
- r <- update idx l $ \layout -> emptyLayout layout r
- case r of
- Nothing -> return ([], Nothing)
- Just (r, la) -> return (r, Just (LayoutList idx la))
-
handleMessage (LayoutList idx l) (fromMessage -> Just (NavigateLayout fn)) =
return $ Just (LayoutList (fn idx) l)
@@ -283,10 +272,6 @@ instance (Show (l a), Typeable l, LayoutSelect l a) =>
r <- update idx l $ \layout -> ((),) <$> handleMessage layout m
return $ LayoutList idx . snd <$> r
- pureMessage (LayoutList idx l) m = runIdentity $ do
- r <- update idx l $ \layout -> return ((), pureMessage layout m)
- return $ LayoutList idx . snd <$> r
-
description (LayoutList idx l) = runIdentity $ do
r <- update idx l $ \l -> return (description l, Nothing)
return $