taffybar-4.0.1: A desktop bar similar to xmobar, but with more GUI
Copyright(c) Ivan A. Malison
LicenseBSD3-style (see LICENSE)
MaintainerIvan A. Malison
Stabilityunstable
Portabilityunportable
Safe HaskellSafe-Inferred
LanguageHaskell2010

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

Documentation

data Context Source #

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

Instances details
Default TaffybarConfig Source # 
Instance details

Defined in System.Taffybar.Context

Methods

def :: TaffybarConfig #

type Taffy m v = ReaderT Context m v Source #

Taffy is a monad transformer that provides Reader for Context.

type TaffyIO v = ReaderT Context IO v Source #

TaffyIO is IO wrapped with a ReaderT providing Context. This is the type of most widgets and callback in taffybar.

data BarConfig Source #

BarConfig specifies the configuration for a single taffybar window.

Constructors

BarConfig 

Fields

Instances

Instances details
Eq BarConfig Source # 
Instance details

Defined in System.Taffybar.Context

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 #

Use the "barConfigGetter" field of Context to get the set of taffybar windows that should active. Will avoid recreating windows if there is already a window with the appropriate geometry and BarConfig.

runX11 :: X11Property a -> TaffyIO a Source #

Run a function needing an X11 connection in TaffyIO.

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.

taffyFork :: ReaderT r IO () -> ReaderT r IO () Source #

A version of "forkIO" in TaffyIO.

unsubscribe :: Unique -> Taffy IO () Source #

Remove the listener associated with the provided Unique from the collection of listeners.