{-# LANGUAGE OverloadedStrings #-} module State where import qualified Data.Char import Data.Default (Default,def) import Data.Text (Text) import Data.Maybe (catMaybes) import qualified Data.Text as Text import qualified Data.Text.IO as Text import qualified Data.Text.Read as Text import Control.Monad (forever) import Blessings.Text (Blessings(Plain,SGR),pp) import qualified Blessings.Internal as Blessings import Control.Concurrent import Data.Time import Data.Map (Map) import qualified Data.Map as Map import Scanner import System.IO import qualified System.Console.Terminal.Size as Term import System.Posix.Signals (Handler(Catch), Signal, installHandler, sigINT) import Much.Screen (Screen(Screen), withScreen) import qualified Hack.Buffer as Buffer import Hack.Buffer (Buffer) --import XMonad.Aeson () --import qualified XMonad.Web.Types () --import qualified XMonad --import qualified XMonad.Web.Types --import qualified XMonad.StackSet import Network.HTTP.Client (Manager) import Pager.Types data State = State { buffer :: Buffer , flashMessage :: Blessings Text -- , now :: UTCTime , termWidth :: Int , termHeight :: Int , charHeight :: Int , charWidth :: Int , screenWidth :: Int , screenHeight :: Int , termHeightPixels :: Int , termWidthPixels :: Int , termBorder :: Int , manager :: Manager -- TODO not part of the state --Request -> Manager -> IO (Response ByteString)Source , workspaceViewportHeight :: Int , workspaceViewportOffset :: Int , foundWorkspaces :: [Text] --, workspaces :: [Text] --, workspaces :: Map Text [XMonad.Web.Types.Window] , workspaces :: Map Text Workspace , workspaceCursor :: Int -- --, xmonadState :: XMonad.Web.Types.State (XMonad.Web.Types.DummyLayout Text) , ex_offsetY :: Int -- TODO Word } instance Default State where def = State { buffer = Buffer.emptyBuffer , flashMessage = "Welcome to pager; quit with ^C" -- , now = UTCTime (fromGregorian 1984 5 23) 49062 , termWidth = 0 , termHeight = 0 , screenHeight = 768 -- TODO , screenWidth = 1366 -- TODO , charWidth = 0 , charHeight = 0 , termWidthPixels = 0 , termHeightPixels = 0 , termBorder = 0 -- , workspaceViewportHeight = 0 , workspaceViewportOffset = 0 , foundWorkspaces = [] , workspaces = Map.empty , workspaceCursor = 0 -- --, xmonadState = def , ex_offsetY = 0 }