Quickshell


MprisPlayer: QtObject

uncreatable
import Quickshell.Services.Mpris

A media player exposed over MPRIS.

WARNING

Support for various functionality and general compliance to the MPRIS specification varies wildly by player. Always check the associated canXyz and xyzSupported properties if available.

NOTE

The TrackList and Playlist interfaces were not implemented as we could not find any media players using them to test against.

  • canControl bool
    readonly
    No details provided
  • canGoNext bool
    readonly
    No details provided
  • canGoPrevious bool
    readonly
    No details provided
  • canPause bool
    readonly
    No details provided
  • canPlay bool
    readonly
    No details provided
  • canQuit bool
    readonly
    No details provided
  • canRaise bool
    readonly
    No details provided
  • canSeek bool
    readonly
    No details provided
  • canSetFullscreen bool
    readonly
    No details provided
  • canTogglePlaying bool
    readonly
    No details provided
  • desktopEntry string
    readonly

    The name of the desktop entry for the media player, or an empty string if not provided.

  • fullscreen bool

    If the player is currently shown in fullscreen.

    May only be written to if Go to canSetFullscreen is true.

  • identity string
    readonly

    The human readable name of the media player.

  • isPlaying bool

    True if Go to playbackState == MprisPlaybackState.Playing.

    Setting this property is equivalent to calling play() or pause(). You cannot set this property if Go to canTogglePlaying is false.

  • length real
    readonly

    The length of the playing track, as seconds, with millisecond precision, or the value of Go to position if Go to lengthSupported is false.

  • lengthSupported bool
    readonly
    No details provided
  • loopState MprisLoopState

    The loop state of the media player, or None if Go to loopSupported is false.

    May only be written to if Go to canControl and Go to loopSupported are true.

  • loopSupported bool
    readonly
    No details provided
  • maxRate real
    readonly
    No details provided
  • metadata unknown
    readonly

    Metadata of the current track.

    A map of common properties is available here. Do not count on any of them actually being present.

    Note that the Go to trackTitle, Go to trackAlbum, Go to trackAlbumArtist, Go to trackArtist and Go to trackArtUrl properties have extra logic to guard against bad players sending weird metadata, and should be used over grabbing the properties directly from the metadata.

  • minRate real
    readonly
    No details provided
  • playbackState MprisPlaybackState

    The playback state of the media player.

    • If Go to canPlay is false, you cannot assign the Playing state.
    • If Go to canPause is false, you cannot assign the Paused state.
    • If Go to canControl is false, you cannot assign the Stopped state. (or any of the others, though their repsective properties will also be false)
  • position real

    The current position in the playing track, as seconds, with millisecond precision, or 0 if Go to positionSupported is false.

    May only be written to if Go to canSeek and Go to positionSupported are true.

    WARNING

    To avoid excessive property updates wasting CPU while position is not actively monitored, position usually will not update reactively, unless a nonlinear change in position occurs, however reading it will always return the current position.

    If you want to actively monitor the position, the simplest way it to emit the Go to positionChanged() signal manually for the duration you are monitoring it, Using a FrameAnimation if you need the value to update smoothly, such as on a slider, or a Timer if not, as shown below.

    FrameAnimation {
      // only emit the signal when the position is actually changing.
      running: player.playbackState == MprisPlaybackState.Playing
      // emit the positionChanged signal every frame.
      onTriggered: player.positionChanged()
    }
    Timer {
      // only emit the signal when the position is actually changing.
      running: player.playbackState == MprisPlaybackState.Playing
      // Make sure the position updates at least once per second.
      interval: 1000
      repeat: true
      // emit the positionChanged signal every second.
      onTriggered: player.positionChanged()
    }
  • positionSupported bool
    readonly
    No details provided
  • rate real

    The speed the song is playing at, as a multiplier.

    Only values between Go to minRate and Go to maxRate (inclusive) may be written to the property. Additionally, It is recommended that you only write common values such as 0.25, 0.5, 1.0, 2.0 to the property, as media players are free to ignore the value, and are more likely to accept common ones.

  • shuffle bool

    If the play queue is currently being shuffled, or false if Go to shuffleSupported is false.

    May only be written if Go to canControl and Go to shuffleSupported are true.

  • shuffleSupported bool
    readonly
    No details provided
  • supportedMimeTypes list <string>
    readonly

    Mime types supported by openUri().

  • supportedUriSchemes list <string>
    readonly

    Uri schemes supported by openUri().

  • trackAlbum string
    readonly

    The current track’s album, or "" if none was provided.

    TIP

    Use player.trackAlbum || "Unknown Album" to provide a message when no album is available.

  • trackAlbumArtist string
    readonly

    The current track’s album artist, or "" if none was provided.

    TIP

    Use player.trackAlbumArtist || "Unknown Album" to provide a message when no album artist is available.

  • trackArtUrl string
    readonly

    The current track’s art url, or "" if none was provided.

  • trackArtist string
    readonly

    The current track’s artist, or an "" if none was provided.

    TIP

    Use player.trackArtist || "Unknown Artist" to provide a message when no artist is available.

  • trackArtists string
    readonly

    [!ERROR] deprecated in favor of Go to trackArtist.

  • trackTitle string
    readonly

    The title of the current track, or "" if none was provided.

    TIP

    Use player.trackTitle || "Unknown Title" to provide a message when no title is available.

  • uniqueId int
    readonly

    An opaque identifier for the current track unique within the current player.

    WARNING

    This is NOT mpris:trackid as that is sometimes missing or nonunique in some players.

  • volume real

    The volume of the playing track from 0.0 to 1.0, or 1.0 if Go to volumeSupported is false.

    May only be written to if Go to canControl and Go to volumeSupported are true.

  • volumeSupported bool
    readonly
    No details provided