summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authortv <tv@krebsco.de>2021-02-28 14:51:13 +0100
committertv <tv@krebsco.de>2021-02-28 14:51:13 +0100
commit032cb86ff8108eb4915a692015da344a41f78506 (patch)
treee4e1afa220dc4f39bc33de657b96dece735cf52b /src
Pager.Types: initHEADmaster
Diffstat (limited to 'src')
-rw-r--r--src/Pager/Types.hs32
1 files changed, 32 insertions, 0 deletions
diff --git a/src/Pager/Types.hs b/src/Pager/Types.hs
new file mode 100644
index 0000000..95dd837
--- /dev/null
+++ b/src/Pager/Types.hs
@@ -0,0 +1,32 @@
+{-# LANGUAGE TemplateHaskell #-}
+module Pager.Types where
+
+import Data.Aeson.TH (Options(fieldLabelModifier), deriveJSON, defaultOptions)
+import Data.Text (Text)
+
+
+data Geometry = Geometry
+ { geometry_x :: Int
+ , geometry_y :: Int
+ , geometry_width :: Int
+ , geometry_height :: Int
+ }
+
+data Window = Window
+ { window_id :: Int
+ , window_title :: Text
+ , window_geometry :: Geometry
+ , window_focused :: Bool
+ , window_urgent :: Bool
+ }
+
+data Workspace = Workspace
+ { workspace_geometry :: Geometry
+ , workspace_focused :: Bool
+ , workspace_name :: Text
+ , workspace_windows :: [Window]
+ }
+
+$(deriveJSON defaultOptions { fieldLabelModifier = tail . dropWhile (/='_') } ''Geometry)
+$(deriveJSON defaultOptions { fieldLabelModifier = tail . dropWhile (/='_') } ''Window)
+$(deriveJSON defaultOptions { fieldLabelModifier = tail . dropWhile (/='_') } ''Workspace)