From f51618000e1d96543e5e0ad72219855e9dea42d8 Mon Sep 17 00:00:00 2001 From: tv Date: Fri, 4 Jun 2021 00:37:48 +0200 Subject: wip --- src/State.hs | 92 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 92 insertions(+) create mode 100644 src/State.hs (limited to 'src/State.hs') diff --git a/src/State.hs b/src/State.hs new file mode 100644 index 0000000..9f55743 --- /dev/null +++ b/src/State.hs @@ -0,0 +1,92 @@ +{-# 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 + , count :: Int + , 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 + , count = 1 + , 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 + } + + -- cgit v1.2.3