// ⚠️ Ensure Colors is imported // import "../../" pragma ComponentBehavior: Bound import QtQuick import QtQuick.Layouts import Quickshell import Quickshell.Services.Mpris import Quickshell.Widgets import "../settings/" import "../../" RowLayout { id: root // 1. Let Repeater loop through the ObjectModel for us Repeater { id: mprisRepeater model: Mpris.players delegate: RowLayout { id: delegateLayout required property var modelData // 2. 🕵️‍♀️ FILTER LOGIC // Check if this specific player is Spotify. // We verify 'modelData' exists and check the name. property bool isSpotify: modelData && modelData.identity.toLowerCase().includes("spotify") // 3. 👻 HIDE NON-SPOTIFY PLAYERS visible: isSpotify // If hidden, take up ZERO space Layout.preferredWidth: isSpotify ? Math.min(implicitWidth, 400) : 0 Layout.fillHeight: true // 4. 🎵 USE 'modelData' DIRECTLY // property string title: modelData.metadata["xesam:title"] || "No Title" // property string artist: modelData.metadata["xesam:artist"] || "Unknown" // property string artUrl: modelData.metadata["mpris:artUrl"] || "" // property bool isPlaying: modelData.playbackStatus === MprisPlaybackStatus.Playing property string title: modelData.trackTitle property string artist: modelData.trackArtist property string artUrl: modelData.trackArtUrl property bool isPlaying: modelData.isPlaying spacing: 10 // 🖼️ ALBUM ART ClippingWrapperRectangle { Layout.alignment: Qt.AlignVCenter radius: 20 IconImage { source: delegateLayout.artUrl // Access property from delegate asynchronous: true implicitSize: 24 } } // 📝 TEXT INFO ColumnLayout { Layout.alignment: Qt.AlignVCenter spacing: 0 visible: parent.visible Text { text: delegateLayout.title color: Colors.foreground font.bold: true font.pixelSize: Settings.fontSize font.family: Settings.font elide: Text.ElideRight Layout.preferredWidth: implicitWidth } Text { font.pixelSize: Settings.fontSize - 2 font.family: Settings.font text: delegateLayout.artist color: Colors.foreground opacity: 0.7 Layout.preferredWidth: implicitWidth } } // ⏯️ CONTROLS } } }