40 lines
1.1 KiB
QML
40 lines
1.1 KiB
QML
import Quickshell
|
|
import Quickshell.Services.Mpris
|
|
import QtQuick
|
|
import QtQuick.Layouts
|
|
import qs
|
|
import qs.settings
|
|
import qs.widgets
|
|
|
|
Rectangle {
|
|
id: root
|
|
color: Colors.surface_container_low
|
|
implicitWidth: songLayout.implicitWidth + 14
|
|
implicitHeight: Settings.config.barHeight / 1.5
|
|
radius: Settings.config.rounding
|
|
property var spotify: root.getSpotify()
|
|
visible: getSpotify() == null ? false : true
|
|
|
|
function getSpotify() {
|
|
for (var i = 0; i < Mpris.players.values.length; i++) {
|
|
if (Mpris.players.values[i].identity == "Spotify" || Mpris.players.values[i] == "spotify") {
|
|
return Mpris.players.values[i];
|
|
} else {
|
|
return null;
|
|
}
|
|
}
|
|
return null;
|
|
}
|
|
|
|
RowLayout {
|
|
id: songLayout
|
|
anchors.centerIn: parent
|
|
CText {
|
|
id: playingSong
|
|
Layout.maximumWidth: 400
|
|
text: root.spotify == null ? "" : root.spotify.trackTitle + " - " + root.spotify.trackArtist
|
|
elide: Text.ElideRight
|
|
}
|
|
}
|
|
}
|