Mpris
signals
changed: emits on any state change except position changeplayer-changed:(busName: string)player-closed:(busName: string)player-added:(busName: string)
properties
players:Player[]see belowcacheCoverArt:booleanwether to cachetrack-cover-url, default:true
methods
getPlayer:(string) => Playerreturns Player that has given string in its busName
Player
signals
position:(position: number)this is signaled when the position is set explicitlyclosed
properties
bus-name:stringthe dbus name that starts withorg.mpris.MediaPlayer2name:stringstripped from busName likespotifyorfirefoxidentity:stringname of the player likeSpotifyorMozilla Firefoxentry:string.desktop entry without the extensiontrackid:stringtrack-artists:string[]list of artiststrack-title:stringtrack-album:stringtrack-cover-url:stringurl to the cover artcover-path:stringpath to the cached cover artmetadata:{ [key: string]: unknown }metadata object, see freedesktop.org for known keysplay-back-status:"Playing" | "Paused" | "Stopped"can-go-next:booleancan-go-prev:booleancan-play:booleanshuffle-status:boolean | nullnull if unsupported by the playerloop-status:"None" | "Track" | "Playlist" | nullnull if unsupported by the playervolume:number-1 if unsupported by the playerlength:number-1 if unsupported by the playerposition:number-1 if unsupported by the player
methods
playPause:() => voidplay:() => voidstop:() => voidnext:() => voidprevious:() => voidshuffle:() => voidloop:() => void
Example Widget
const mpris = await Service.import('mpris')
/** @param {import('types/service/mpris').MprisPlayer} player */const Player = player => Widget.Button({ onClicked: () => player.playPause(), child: Widget.Label().hook(player, label => { const { track_artists, track_title } = player; label.label = `${track_artists.join(', ')} - ${track_title}`; }),})
const players = Widget.Box({ children: mpris.bind('players').as(p => p.map(Player))})Example Media Widget
