repositories / dotfiles

dotfiles

bugabingas dorkfiles

owned by bugabinga

quickshell/nugu/MediaWidget.qml

Raw
import QtQuick
import Quickshell.Services.Mpris
import "."

StatusItem {
    id: root


    // MPRIS is optional. Show nothing when idle so the clock stays compact and
    // Ironbar remains the visual baseline for later full comparison.
    readonly property var player: Mpris.players.values.find(p => p.isPlaying) || Mpris.players.values[0] || null
    readonly property string title: player ? (player.trackTitle || "") : ""
    readonly property string artist: player ? (player.trackArtist || "") : ""
    readonly property string joined: title.length > 0 && artist.length > 0 ? `${title} / ${artist}` : (title || artist)

    text: joined.length > 42 ? `${joined.slice(0, 39)}…` : joined
    minWidth: 0
}