import Quickshell.Services.Mpris import QtQuick import "../components" Item { id: root signal clicked // Pick the first playing player, fall back to first available readonly property var player: { const vals = Mpris.players.values for (const p of vals) { if (p.isPlaying) return p } return vals.length > 0 ? vals[0] : null } visible: player !== null implicitWidth: player ? Math.min(240, titleLabel.implicitWidth + 20) : 0 implicitHeight: 24 Text { id: titleLabel anchors.centerIn: parent width: parent.width - 20 text: root.player?.trackTitle ?? "" color: Theme.text font.pixelSize: 12 elide: Text.ElideRight horizontalAlignment: Text.AlignHCenter } MouseArea { anchors.fill: parent onClicked: root.clicked() } }