| Copyright | (c) Ivan A. Malison | 
|---|---|
| License | BSD3-style (see LICENSE) | 
| Maintainer | Ivan A. Malison | 
| Stability | unstable | 
| Portability | unportable | 
| Safe Haskell | Safe-Inferred | 
| Language | Haskell2010 | 
System.Taffybar.Context
Description
The System.Taffybar.Context module provides the core functionality of the
 taffybar library. It gets its name from the Context record, which stores
 runtime information and objects, which are used by many of the widgets that
 taffybar provides. Context is typically accessed through the Reader
 interface of TaffyIO.
Synopsis
- data Context = Context {- x11ContextVar :: MVar X11Context
- listeners :: MVar SubscriptionList
- contextState :: MVar (Map TypeRep Value)
- existingWindows :: MVar [(BarConfig, Window)]
- sessionDBusClient :: Client
- systemDBusClient :: Client
- getBarConfigs :: BarConfigGetter
- contextBarConfig :: Maybe BarConfig
 
- data TaffybarConfig = TaffybarConfig {}
- type Taffy m v = ReaderT Context m v
- type TaffyIO v = ReaderT Context IO v
- data BarConfig = BarConfig {- strutConfig :: StrutConfig
- widgetSpacing :: Int32
- startWidgets :: [TaffyIO Widget]
- centerWidgets :: [TaffyIO Widget]
- endWidgets :: [TaffyIO Widget]
- barId :: Unique
 
- type BarConfigGetter = TaffyIO [BarConfig]
- appendHook :: TaffyIO () -> TaffybarConfig -> TaffybarConfig
- buildContext :: TaffybarConfig -> IO Context
- buildEmptyContext :: IO Context
- defaultTaffybarConfig :: TaffybarConfig
- getState :: forall t. Typeable t => Taffy IO (Maybe t)
- getStateDefault :: Typeable t => Taffy IO t -> Taffy IO t
- putState :: forall t. Typeable t => Taffy IO t -> Taffy IO t
- forceRefreshTaffyWindows :: TaffyIO ()
- refreshTaffyWindows :: TaffyIO ()
- runX11 :: X11Property a -> TaffyIO a
- runX11Def :: a -> X11Property a -> TaffyIO a
- subscribeToAll :: Listener -> Taffy IO Unique
- subscribeToPropertyEvents :: [String] -> Listener -> Taffy IO Unique
- taffyFork :: ReaderT r IO () -> ReaderT r IO ()
- unsubscribe :: Unique -> Taffy IO ()
Documentation
A Context value holds all of the state associated with a single running instance of taffybar. It is typically accessed from a widget constructor through the TaffyIO monad transformer stack.
Constructors
| Context | |
| Fields 
 | |
data TaffybarConfig Source #
TaffybarConfig provides an advanced interface for configuring taffybar.
 Through the getBarConfigsParam, it is possible to specify different
 taffybar configurations depending on the number of monitors present, and even
 to specify different taffybar configurations for each monitor.
Constructors
| TaffybarConfig | |
| Fields 
 | |
Instances
| Default TaffybarConfig Source # | |
| Defined in System.Taffybar.Context Methods def :: TaffybarConfig # | |
BarConfig specifies the configuration for a single taffybar window.
Constructors
| BarConfig | |
| Fields 
 | |
type BarConfigGetter = TaffyIO [BarConfig] Source #
appendHook :: TaffyIO () -> TaffybarConfig -> TaffybarConfig Source #
Append the provided TaffyIO hook to the startupHook of the given
 TaffybarConfig.
buildContext :: TaffybarConfig -> IO Context Source #
Build the Context for a taffybar process.
buildEmptyContext :: IO Context Source #
Build an empty taffybar context. This function is mostly useful for
 invoking functions that yield TaffyIO values in a testing setting (e.g. in
 a repl).
defaultTaffybarConfig :: TaffybarConfig Source #
Default values for a TaffybarConfig. Not usuable without at least
 properly setting getBarConfigsParam.
getState :: forall t. Typeable t => Taffy IO (Maybe t) Source #
Get a state value by type from the contextState field of Context.
getStateDefault :: Typeable t => Taffy IO t -> Taffy IO t Source #
Like "putState", but avoids aquiring a lock if the value is already in the map.
putState :: forall t. Typeable t => Taffy IO t -> Taffy IO t Source #
Get a value of the type returned by the provided action from the the current taffybar state, unless the state does not exist, in which case the action will be called to populate the state map.
forceRefreshTaffyWindows :: TaffyIO () Source #
Forcibly refresh taffybar windows, even if there are existing windows that
 correspond to the uniques in the bar configs yielded by barConfigGetter.
refreshTaffyWindows :: TaffyIO () Source #
runX11Def :: a -> X11Property a -> TaffyIO a Source #
Use runX11 together with postX11RequestSyncProp on the provided
 property. Return the provided default if Nothing is returned
 postX11RequestSyncProp.
subscribeToAll :: Listener -> Taffy IO Unique Source #
Subscribe to all incoming events on the X11 event loop. The returned Unique value can be used to unregister the listener using "unsuscribe".
subscribeToPropertyEvents :: [String] -> Listener -> Taffy IO Unique Source #
Subscribe to X11 PropertyEvents where the property changed is in the provided list.