Safe Haskell | Safe-Inferred |
---|---|
Language | GHC2021 |
This module contains the logic for graphical app definition.
Synopsis
- data Display = Display {}
- data DisplayEvent
- newtype AppTag = AppTag Text
- data AppEvent
- eventFromMessage :: DisplayClient -> DataMessage -> Maybe (WinID, AppEvent)
- data App = App {
- name :: ProgramName
- tags :: Set AppTag
- title :: Text
- description :: Text
- size :: Maybe (Int, Int)
- xfiles :: [XStaticFile]
- acceptFiles :: Maybe ContentType
- start :: AppContext -> ProcessIO ()
- defaultApp :: ProgramName -> (AppContext -> ProcessIO ()) -> App
- data AppContext = AppContext {
- clients :: DisplayClients
- wid :: WinID
- pipe :: Pipe AppEvent
- shared :: AppSharedContext
- data AppSharedContext = AppSharedContext {
- display :: Display
- processEnv :: ProcessEnv
- appSet :: AppSet
- dynamics :: Dynamics
- apps :: Apps
- newAppSharedContext :: Display -> ProcessEnv -> AppSet -> STM AppSharedContext
- newtype Apps = Apps (TVar (Map WinID AppInstance))
- newApps :: STM Apps
- unregisterApp :: Apps -> AppInstance -> STM ()
- registerApp :: Apps -> AppInstance -> STM ()
- getApps :: Apps -> STM (Map WinID AppInstance)
- data AppInstance = AppInstance {}
- newtype AppSet = AppSet (Map ProgramName App)
- appSetApps :: AppSet -> [App]
- sendHtmlOnConnect :: HtmlT STM () -> AppEvent -> ProcessIO ()
- newAppSet :: [App] -> AppSet
- launchApp :: AppSet -> ProgramName -> AppSharedContext -> DisplayClients -> WinID -> ProcessIO (Maybe AppInstance)
- startApp :: Text -> App -> AppSharedContext -> DisplayClients -> WinID -> ProcessIO AppInstance
- startApps :: [App] -> Display -> DisplayClients -> ProcessIO AppSharedContext
- tagIcon :: AppTag -> Maybe Text
- startAppScript :: App -> [Pair] -> Text
- appSetHtml :: Monad m => WinID -> AppSet -> HtmlT m ()
Documentation
data DisplayEvent #
Instances
Application tag.
The type of event an app receive
AppDisplay DisplayEvent | A display event (e.g. to mount the UI) |
AppTrigger GuiEvent | A trigger event (e.g. onclick) |
AppData DataEvent | A data event (e.g. for raw data) |
AppFile Directory (Maybe File) | A file event (e.g. a new file opened) |
Instances
ToJSON AppEvent # | |
Defined in Butler.App | |
Generic AppEvent # | |
type Rep AppEvent # | |
Defined in Butler.App type Rep AppEvent = D1 ('MetaData "AppEvent" "Butler.App" "butler-0.0.1.0-inplace" 'False) ((C1 ('MetaCons "AppDisplay" 'PrefixI 'False) (S1 ('MetaSel ('Nothing :: Maybe Symbol) 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 DisplayEvent)) :+: C1 ('MetaCons "AppTrigger" 'PrefixI 'False) (S1 ('MetaSel ('Nothing :: Maybe Symbol) 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 GuiEvent))) :+: (C1 ('MetaCons "AppData" 'PrefixI 'False) (S1 ('MetaSel ('Nothing :: Maybe Symbol) 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 DataEvent)) :+: C1 ('MetaCons "AppFile" 'PrefixI 'False) (S1 ('MetaSel ('Nothing :: Maybe Symbol) 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 Directory) :*: S1 ('MetaSel ('Nothing :: Maybe Symbol) 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 (Maybe File))))) |
eventFromMessage :: DisplayClient -> DataMessage -> Maybe (WinID, AppEvent) #
A graphical application definition.
App | |
|
defaultApp :: ProgramName -> (AppContext -> ProcessIO ()) -> App #
data AppContext #
The application context
AppContext | |
|
data AppSharedContext #
AppSharedContext | |
|
newAppSharedContext :: Display -> ProcessEnv -> AppSet -> STM AppSharedContext #
unregisterApp :: Apps -> AppInstance -> STM () #
registerApp :: Apps -> AppInstance -> STM () #
data AppInstance #
Instances
Generic AppInstance # | |
Defined in Butler.App type Rep AppInstance :: Type -> Type # from :: AppInstance -> Rep AppInstance x # to :: Rep AppInstance x -> AppInstance # | |
type Rep AppInstance # | |
Defined in Butler.App type Rep AppInstance = D1 ('MetaData "AppInstance" "Butler.App" "butler-0.0.1.0-inplace" 'False) (C1 ('MetaCons "AppInstance" 'PrefixI 'True) ((S1 ('MetaSel ('Just "app") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 App) :*: S1 ('MetaSel ('Just "process") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 Process)) :*: (S1 ('MetaSel ('Just "wid") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 WinID) :*: S1 ('MetaSel ('Just "pipeAE") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 (Pipe AppEvent))))) |
appSetApps :: AppSet -> [App] #
sendHtmlOnConnect :: HtmlT STM () -> AppEvent -> ProcessIO () #
A convenient helper to mount the UI when a new user connect.
launchApp :: AppSet -> ProgramName -> AppSharedContext -> DisplayClients -> WinID -> ProcessIO (Maybe AppInstance) #
startApp :: Text -> App -> AppSharedContext -> DisplayClients -> WinID -> ProcessIO AppInstance #
startApps :: [App] -> Display -> DisplayClients -> ProcessIO AppSharedContext #
startAppScript :: App -> [Pair] -> Text #