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

Safe Haskell | None
Language | Haskell2010

System.Taffybar.Widget.Generic.PollingLabel

Description

This is a simple text widget that updates its contents by calling a callback at a set interval.

Synopsis

- pollingLabelNew :: MonadIO m => Text -> Double -> IO Text -> m Widget
- pollingLabelNewWithTooltip :: MonadIO m => Text -> Double -> IO (Text, Maybe Text) -> m Widget

# Documentation

pollingLabelNew Source #

Arguments

:: MonadIO m |
=> Text | Initial value for the label
-> Double | Update interval (in seconds)
-> IO Text | Command to run to get the input string
-> m Widget |

Create a new widget that updates itself at regular intervals. The function

    pollingLabelNew initialString cmd interval

returns a widget with initial text `initialString`. The widget forks a thread to update its contents every `interval` seconds. The command should return a string with any HTML entities escaped. This is not checked by the function, since Pango markup shouldn't be escaped. Proper input sanitization is up to the caller.

If the IO action throws an exception, it will be swallowed and the label will not update until the update interval expires.

pollingLabelNewWithTooltip Source #

Arguments

:: MonadIO m |
=> Text | Initial value for the label
-> Double | Update interval (in seconds)
-> IO (Text, Maybe Text) | Command to run to get the input string
-> m Widget |