From 032cb86ff8108eb4915a692015da344a41f78506 Mon Sep 17 00:00:00 2001 From: tv Date: Sun, 28 Feb 2021 14:51:13 +0100 Subject: Pager.Types: init --- pager.cabal | 18 ++++++++++++++++++ src/Pager/Types.hs | 32 ++++++++++++++++++++++++++++++++ 2 files changed, 50 insertions(+) create mode 100644 pager.cabal create mode 100644 src/Pager/Types.hs 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 +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) -- cgit v1.2.3