Copyright | (c) Ivan A. Malison |
---|---|
License | BSD3-style (see LICENSE) |
Maintainer | Ivan A. Malison |
Stability | unstable |
Portability | unportable |
Safe Haskell | Safe-Inferred |
Language | Haskell2010 |
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
- mprisLog :: (MonadIO m, Show t) => Priority -> String -> t -> m ()
- type WidgetAdder a m = (IsDescendantOf Widget a, MonadIO m, GObject a) => a -> m ()
- type UpdateMPRIS2PlayerWidget a = (forall w. WidgetAdder w IO) -> Maybe a -> Maybe NowPlaying -> TaffyIO a
- data MPRIS2Config a = MPRIS2Config {}
- defaultMPRIS2Config :: MPRIS2Config MPRIS2PlayerWidget
- data MPRIS2PlayerWidget = MPRIS2PlayerWidget {}
- data SimpleMPRIS2PlayerConfig = SimpleMPRIS2PlayerConfig {
- setNowPlayingLabel :: NowPlaying -> IO Text
- showPlayerWidgetFn :: NowPlaying -> IO Bool
- defaultPlayerConfig :: SimpleMPRIS2PlayerConfig
- makeExcept :: String -> (a -> IO (Maybe b)) -> a -> ExceptT String IO b
- loadIconAtSize :: Client -> BusName -> Int32 -> IO Pixbuf
- simplePlayerWidget :: SimpleMPRIS2PlayerConfig -> UpdateMPRIS2PlayerWidget MPRIS2PlayerWidget
- mpris2New :: TaffyIO Widget
- mpris2NewWithConfig :: MPRIS2Config a -> TaffyIO Widget
- playingText :: MonadIO m => Int -> Int -> NowPlaying -> m Text
Documentation
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
|
data MPRIS2PlayerWidget Source #
Constructors
MPRIS2PlayerWidget | |
Fields
|
data SimpleMPRIS2PlayerConfig Source #
Constructors
SimpleMPRIS2PlayerConfig | |
Fields
|
Instances
Default SimpleMPRIS2PlayerConfig Source # | |
Defined in System.Taffybar.Widget.MPRIS2 Methods |
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.