blob: ea80ba9f54667490604afb84d97265e28a0d8eb7 (
plain) (
blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
|
module Rahm.Desktop.Layout where
import GHC.TypeLits
import Data.Proxy (Proxy(..))
import Control.Arrow (second)
import XMonad.Hooks.ManageDocks
import XMonad.Layout.Circle
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
import XMonad.Layout.Dishes
import XMonad.Layout.MosaicAlt
import XMonad.Layout.Fullscreen
import qualified XMonad.Layout.Dwindle as D
import XMonad.Layout
import XMonad.Layout.LayoutModifier
import XMonad
import XMonad.Core
import XMonad.Layout.NoBorders (smartBorders, noBorders)
import Rahm.Desktop.Layout.CornerLayout (Corner(..))
import Rahm.Desktop.Layout.List
import Rahm.Desktop.Windows
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 Rahm.Desktop.Layout.Hole
import Rahm.Desktop.Layout.ConsistentMosaic
import qualified Data.Map as M
import qualified Rahm.Desktop.StackSet as W
myLayout =
fullscreenFull $
avoidStruts myLayoutList
mySpacing = spacingRaw True (Border 5 5 5 5) True (Border 5 5 5 5) True
mods =
mySpacing . poppable . flippable . rotateable . hole
myLayoutList =
layoutList $
mods (reinterpretIncMaster $ spiral (6/7)) |:
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))) |:
mods Grid |:
mods (Dishes 2 (1/6)) |:
mods (reinterpretIncMaster $ D.Dwindle D.R D.CW 1.5 1.1) |:
nil
nLayouts :: Int
nLayouts = layoutListLength myLayoutList
-- Mosaic doesn't have the concept of a "Master Space", so reinterpret messages
-- intended to modify the master space and instead have those messages expand
-- and shrink the current window.
--
-- "ForMosaic" is an instance of the Symbol kind. This is some neat type-system
-- hacking one can do in Haskell.
instance DoReinterpret "ForMosaic" where
-- IncMaster message
reinterpretMessage _ (fromMessage -> Just (IncMasterN n)) = do
Just . SomeMessage <$> (
if n > 0
then expandPositionAlt
else shrinkPositionAlt)
-- ResizeMaster message
reinterpretMessage _ (fromMessage -> Just m) = do
Just . SomeMessage <$>
(case m of
Expand -> expandPositionAlt
Shrink -> shrinkPositionAlt)
-- Messages that don't match the above, just leave it unmodified.
reinterpretMessage _ m = return (Just m)
instance DoReinterpret "IncMasterToResizeMaster" where
reinterpretMessage _ (fromMessage -> Just (IncMasterN n)) =
return $ Just $
if n > 0
then SomeMessage Expand
else SomeMessage Shrink
reinterpretMessage _ m = return (Just m)
modifyMosaic :: l a -> ModifiedLayout (ReinterpretMessage "ForMosaic") l a
modifyMosaic = ModifiedLayout ReinterpretMessage
reinterpretIncMaster ::
l a -> ModifiedLayout (ReinterpretMessage "IncMasterToResizeMaster") l a
reinterpretIncMaster = ModifiedLayout ReinterpretMessage
data UsingTall = UsingTall deriving (Read, Show)
instance Describer UsingTall Tall where
newDescription _ (Tall mast _ _) _ = "Tall(" ++ show mast ++ ")"
data UsingThreeCol = UsingThreeCol deriving (Read, Show)
instance Describer UsingThreeCol ThreeCol where
newDescription _ (ThreeCol mast _ _) _ = "ThreeCol(" ++ show mast ++ ")"
newDescription _ (ThreeColMid mast _ _) _ = "ThreeColMid(" ++ show mast ++ ")"
|