Copyright | (c) José A. Romero L. |
---|---|
License | BSD3-style (see LICENSE) |
Maintainer | José A. Romero L. <escherdragon@gmail.com> |
Stability | unstable |
Portability | unportable |
Safe Haskell | None |
Language | Haskell2010 |
System.Taffybar.Pager
Description
Common support for pager widgets. This module does not provide itself any widgets, but implements an event dispatcher on which widgets can subscribe the desktop events they're interested in, as well as common configuration facilities.
N.B. If you're just looking for a drop-in replacement for the System.Taffybar.XMonadLog widget that is clickable and doesn't require DBus, you may want to see first System.Taffybar.TaffyPager.
You need only one Pager component to instantiate any number of pager widgets:
pager <- pagerNew defaultPagerConfig let wss = wspaceSwitcherNew pager -- Workspace Switcher widget los = layoutSwitcherNew pager -- Layout Switcher widget wnd = windowSwitcherNew pager -- Window Switcher widget
- data Pager
- data PagerConfig = PagerConfig {
- activeWindow :: String -> String
- activeLayout :: String -> String
- activeWorkspace :: String -> String
- hiddenWorkspace :: String -> String
- emptyWorkspace :: String -> String
- visibleWorkspace :: String -> String
- urgentWorkspace :: String -> String
- widgetSep :: String
- defaultPagerConfig :: PagerConfig
- pagerNew :: PagerConfig -> IO Pager
- subscribe :: Pager -> Listener -> String -> IO ()
- colorize :: String -> String -> String -> String
- shorten :: Int -> String -> String
- wrap :: String -> String -> String -> String
- escape :: String -> String
Documentation
data PagerConfig Source #
Structure contanining functions to customize the pretty printing of different widget elements.
Constructors
PagerConfig | |
Fields
|
defaultPagerConfig :: PagerConfig Source #
Default pretty printing options.
pagerNew :: PagerConfig -> IO Pager Source #
Creates a new Pager component (wrapped in the IO Monad) that can be used by widgets for subscribing X11 events.
subscribe :: Pager -> Listener -> String -> IO () Source #
Registers the given Listener as a subscriber of events of the given type: whenever a new event of the type with the given name arrives to the Pager, it will execute Listener on it.
Creates markup with the given foreground and background colors and the given contents.
shorten :: Int -> String -> String Source #
Limit a string to a certain length, adding "..." if truncated.
Wrap the given string in the given delimiters.