change mpris to only show spotify

This commit is contained in:
lucy 2026-05-16 22:41:31 +02:00
commit 798f6a618c

View file

@ -8,41 +8,26 @@ import qs.settings
WrapperRectangle {
id: root
property MprisPlayer spotify: findSpotify()
visible: spotify != null
property MprisPlayer spotify: {
for (const player of Mpris.players.values) {
if (player.identity === "Spotify")
return player;
}
return null;
}
visible: spotify !== null && spotify.playbackState === MprisPlaybackState.Playing
leftMargin: 8
rightMargin: 8
color: Colors.base01
radius: Config.rounding
function findSpotify() {
for (let i = 0; i < Mpris.players.values.length; i++) {
let current = Mpris.players.values[i];
if (current.identity == 'spotify' || 'Spotify') {
return current;
} else {
return null;
}
child: RowLayout {
MaterialIcon {
text: "music_note_2"
}
return null;
}
child: WrapperMouseArea {
id: clickHandler
acceptedButtons: Qt.LeftButton | Qt.RightButton
cursorShape: Qt.PointingHandCursor
onClicked: mouse => {
if (mouse.button == Qt.RightButton) {
root.spotify.togglePlaying();
}
}
child: RowLayout {
MaterialIcon {
text: "music_note_2"
}
StyledText {
Layout.maximumWidth: 400
text: root.spotify?.trackTitle + " - " + root.spotify?.trackArtists
elide: Text.ElideRight
}
StyledText {
Layout.maximumWidth: 400
text: root.spotify?.trackTitle + " - " + root.spotify?.trackArtists
elide: Text.ElideRight
}
}
}