From f51618000e1d96543e5e0ad72219855e9dea42d8 Mon Sep 17 00:00:00 2001 From: tv Date: Fri, 4 Jun 2021 00:37:48 +0200 Subject: wip --- src/Pager/Types.hs | 20 +++++++++++++++++++- 1 file changed, 19 insertions(+), 1 deletion(-) (limited to 'src/Pager/Types.hs') diff --git a/src/Pager/Types.hs b/src/Pager/Types.hs index 95dd837..2cec025 100644 --- a/src/Pager/Types.hs +++ b/src/Pager/Types.hs @@ -5,6 +5,24 @@ import Data.Aeson.TH (Options(fieldLabelModifier), deriveJSON, defaultOptions) import Data.Text (Text) +data Action + = None + -- | FocusWindow Int (Maybe Text) + | FocusWorkspace Text + -- | MoveWindowToWorkspace Int Text + -- | CopyWindowToWorkspace Int Text + | Batch Action Action + +instance Monoid Action where + mempty = None + +instance Semigroup Action where + x <> None = x + None <> x = x + Batch x1 x2 <> Batch x3 x4 = x1 <> x2 <> x3 <> x4 + Batch x1 x2 <> x3 = x1 <> x2 <> x3 + x1 <> x2 = Batch x1 x2 + data Geometry = Geometry { geometry_x :: Int , geometry_y :: Int @@ -24,7 +42,7 @@ data Workspace = Workspace { workspace_geometry :: Geometry , workspace_focused :: Bool , workspace_name :: Text - , workspace_windows :: [Window] + , workspace_windows :: [Window] -- sorted by z-order, earlier windows overlap later ones } $(deriveJSON defaultOptions { fieldLabelModifier = tail . dropWhile (/='_') } ''Geometry) -- cgit v1.2.3