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.Widget.MPRIS2

Description

This is a "Now Playing" widget that listens for MPRIS2 events on DBus. You can find the MPRIS2 specification here at (https://specifications.freedesktop.org/mpris-spec/latest/).

Synopsis

Documentation

mprisLog :: (MonadIO m, Show t) => Priority -> String -> t -> m () Source #

type WidgetAdder a m = (IsDescendantOf Widget a, MonadIO m, GObject a) => a -> m () Source #

A type representing a function that produces an IO action that adds the provided widget to some container.

type UpdateMPRIS2PlayerWidget a = (forall w. WidgetAdder w IO) -> Maybe a -> Maybe NowPlaying -> TaffyIO a Source #

The type of a customization function that is used to update a widget with the provided now playing info. The type a should be the internal state used for the widget (typically just references to the child widgets that may need to be updated ). When the provided value is nothing, it means that the widget does not exist yet and it should be instantiated. When the provided NowPlaying value is Nothing, the dbus client is no longer, and typically the widget should be hidden.

data MPRIS2Config a Source #

Configuration for an MPRIS2 Widget

Constructors

MPRIS2Config 

Fields

makeExcept :: String -> (a -> IO (Maybe b)) -> a -> ExceptT String IO b Source #

simplePlayerWidget :: SimpleMPRIS2PlayerConfig -> UpdateMPRIS2PlayerWidget MPRIS2PlayerWidget Source #

This is the default player widget constructor that is used to build mpris widgets. It provides only an icon and NowPlaying text.

mpris2New :: TaffyIO Widget Source #

Construct a new MPRIS2 widget using the simplePlayerWidget constructor.

mpris2NewWithConfig :: MPRIS2Config a -> TaffyIO Widget Source #

Construct a new MPRIS2 widget with the provided configuration.

playingText :: MonadIO m => Int -> Int -> NowPlaying -> m Text Source #

Generate now playing text with the artist truncated to a maximum given by the first provided int, and the song title truncated to a maximum given by the second provided int.