Documentation
¶
Overview ¶
Package mpris is a bar module that talks to MPRIS2-compatible media players over D-Bus (session bus) and shows the currently playing track plus prev/play-pause/next controls.
Player selection strategy: prefer a player whose PlaybackStatus is "Playing"; if none is playing, fall back to the first connected one (so paused tracks still show with their controls). When the user configures a priority list, walk it in order; otherwise sort the connected players alphabetically by bus name for stability.
Index ¶
Constants ¶
This section is empty.
Variables ¶
var DefaultIcons = Icons{
Music: "",
Prev: "",
Next: "",
Play: "",
Pause: "",
}
DefaultIcons is the Nerd Font codepoint set used when the caller doesn't override MPRIS.Icons.
Functions ¶
This section is empty.
Types ¶
type Icons ¶
Icons groups the per-state media glyphs. New initialises Icons to the Nerd Font DefaultIcons below; callers can override the field directly to change individual glyphs.
type MPRIS ¶
type MPRIS struct {
Interval time.Duration
FG color.RGBA
BG color.RGBA
MaxTitleRune int // max characters of "Artist – Title" (0 = no limit)
Players []string // optional priority list of player short-names (e.g. "spotify", "mpv")
Icons Icons
// contains filtered or unexported fields
}
MPRIS polls the session D-Bus for active MPRIS2 players and renders title + transport controls for the preferred one.
func New ¶
New builds an MPRIS module. interval defaults to 1s. maxTitleRune defaults to 30 if zero.