diff options
author | tv <tv@krebsco.de> | 2021-06-04 00:37:48 +0200 |
---|---|---|
committer | tv <tv@krebsco.de> | 2021-06-04 00:37:48 +0200 |
commit | f51618000e1d96543e5e0ad72219855e9dea42d8 (patch) | |
tree | dc63bb05e748c008f2d816f4079e659dffe0cafb /src/State.hs | |
parent | 032cb86ff8108eb4915a692015da344a41f78506 (diff) |
wipwip2
Diffstat (limited to 'src/State.hs')
-rw-r--r-- | src/State.hs | 92 |
1 files changed, 92 insertions, 0 deletions
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 + } + + |