add mpris spotify module

This commit is contained in:
lucy 2026-05-14 16:51:33 +02:00
commit af77103d71
2 changed files with 32 additions and 2 deletions

View file

@ -1,8 +1,31 @@
import Quickshell.Mpris
import Quickshell.Services.Mpris
import Quickshell.Widgets
import QtQuick
import QtQuick.Layouts
import qs
import qs.widgets
WrapperRectangle {}
WrapperRectangle {
id: root
property MprisPlayer spotify: findSpotify()
required property int barHeight
property double vertMargin: barHeight / 4 - 4
visible: spotify != null
topMargin: vertMargin
bottomMargin: vertMargin
leftMargin: 8
rightMargin: 8
color: Colors.base01
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;
}
}
return null;
}
StyledText {
text: root.spotify?.trackTitle + " - " + root.spotify?.trackArtists
}
}