{-# 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] -- sorted by z-order, earlier windows overlap later ones } $(deriveJSON defaultOptions { fieldLabelModifier = tail . dropWhile (/='_') } ''Geometry) $(deriveJSON defaultOptions { fieldLabelModifier = tail . dropWhile (/='_') } ''Window) $(deriveJSON defaultOptions { fieldLabelModifier = tail . dropWhile (/='_') } ''Workspace)