fix centering issue in Mpris.qml

This commit is contained in:
lucy 2025-12-29 22:48:47 +01:00
parent 17b68ea02d
commit 358fc5fe89
2 changed files with 7 additions and 8 deletions

View File

@ -17,10 +17,10 @@ Item {
// 1. Let Repeater loop through the ObjectModel for us // 1. Let Repeater loop through the ObjectModel for us
Repeater { Repeater {
id: mprisRepeater id: mprisRepeater
anchors.verticalCenter: parent.verticalCenter
model: Mpris.players model: Mpris.players
delegate: Item { delegate: Item {
id: delegateItem
required property var modelData required property var modelData
implicitHeight: 34 implicitHeight: 34
@ -46,10 +46,11 @@ Item {
} }
RowLayout { RowLayout {
id: delegateLayout id: delegateLayout
anchors.centerIn: parent
// 2. 🕵 FILTER LOGIC // 2. 🕵 FILTER LOGIC
// Check if this specific player is Spotify. // Check if this specific player is Spotify.
// We verify 'modelData' exists and check the name. // We verify 'modelData' exists and check the name.
property bool isSpotify: modelData && modelData.identity.toLowerCase().includes("spotify") property bool isSpotify: delegateItem.modelData && delegateItem.modelData.identity.toLowerCase().includes("spotify")
// 3. 👻 HIDE NON-SPOTIFY PLAYERS // 3. 👻 HIDE NON-SPOTIFY PLAYERS
visible: isSpotify visible: isSpotify
@ -58,10 +59,10 @@ Item {
Layout.preferredWidth: isSpotify ? Math.min(implicitWidth, 400) : 0 Layout.preferredWidth: isSpotify ? Math.min(implicitWidth, 400) : 0
Layout.fillHeight: true Layout.fillHeight: true
property string title: modelData.trackTitle property string title: delegateItem.modelData.trackTitle
property string artist: modelData.trackArtist property string artist: delegateItem.modelData.trackArtist
property string artUrl: modelData.trackArtUrl property string artUrl: delegateItem.modelData.trackArtUrl
property bool isPlaying: modelData.isPlaying property bool isPlaying: delegateItem.modelData.isPlaying
spacing: 10 spacing: 10
@ -81,7 +82,6 @@ Item {
// 📝 TEXT INFO // 📝 TEXT INFO
ColumnLayout { ColumnLayout {
Layout.alignment: Qt.AlignVCenter
spacing: 0 spacing: 0
visible: parent.visible visible: parent.visible

View File

@ -4,7 +4,6 @@ import Quickshell
import "./modules/bar/" import "./modules/bar/"
import "./modules/wallpaper/" import "./modules/wallpaper/"
import "./modules/notifications/" import "./modules/notifications/"
import "./modules/settings/"
ShellRoot { ShellRoot {
Variants { Variants {