taffybar-0.4.5: A desktop bar similar to xmobar, but with more GUI

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

Synopsis

- 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 Pager Source

Structure containing the state of the Pager.

data PagerConfig Source

Structure contanining functions to customize the pretty printing of different widget elements.

Constructors

PagerConfig |

Fields

activeWindow :: String -> String

  the name of the active window.

activeLayout :: String -> String

  the currently active layout.

activeWorkspace :: String -> String

  the currently active workspace.

hiddenWorkspace :: String -> String

  inactive workspace with windows.

emptyWorkspace :: String -> String

  inactive workspace with no windows.

visibleWorkspace :: String -> String

  all other visible workspaces (Xinerama or XRandR).

urgentWorkspace :: String -> String

  workspaces containing windows with the urgency hint set.

widgetSep :: String

  separator to use between desktop widgets in `TaffyPager`.

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.

colorize Source

Arguments

:: String | Foreground color.
-> String | Background color.
-> String | Contents.
-> String |

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 Source

Arguments

:: String | Left delimiter.
-> String | Right delimiter.
-> String | Output string.
-> String |

Wrap the given string in the given delimiters.

escape :: String -> String Source

Escape strings so that they can be safely displayed by Pango in the bar widget