summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--pager.cabal18
-rw-r--r--src/Pager/Types.hs32
2 files changed, 50 insertions, 0 deletions
diff --git a/pager.cabal b/pager.cabal
new file mode 100644
index 0000000..b3df3c3
--- /dev/null
+++ b/pager.cabal
@@ -0,0 +1,18 @@
+cabal-version: 2.4
+
+name: pager
+version: 1.0.0
+license: MIT
+author: tv <tv@krebsco.de>
+maintainer: tv@krebsco.de
+build-type: Simple
+
+library
+ build-depends: base
+ , aeson
+ , template-haskell
+ , text
+ default-language: Haskell2010
+ exposed-modules: Pager.Types
+ ghc-options: -O2 -Wall
+ hs-source-dirs: src
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)