summaryrefslogtreecommitdiffstats
path: root/src/Pager/Types.hs
diff options
context:
space:
mode:
Diffstat (limited to 'src/Pager/Types.hs')
-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)