38 lines
1 KiB
QML
38 lines
1 KiB
QML
import Quickshell.Services.Mpris
|
|
import Quickshell.Widgets
|
|
import QtQuick
|
|
import QtQuick.Layouts
|
|
import qs
|
|
import qs.widgets
|
|
import qs.settings
|
|
|
|
Rectangle {
|
|
id: root
|
|
required property double moduleHeight
|
|
implicitHeight: moduleHeight
|
|
implicitWidth: songLayout.implicitWidth + 32
|
|
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
|
|
clip: true
|
|
color: Colors.base01
|
|
radius: Config.rounding
|
|
RowLayout {
|
|
id: songLayout
|
|
anchors.centerIn: root
|
|
MaterialIcon {
|
|
text: "\ueafc"
|
|
}
|
|
StyledText {
|
|
Layout.maximumWidth: 400
|
|
Layout.maximumHeight: Config.barHeight / 1.6
|
|
text: root.spotify?.trackTitle + " - " + root.spotify?.trackArtists
|
|
elide: Text.ElideRight
|
|
}
|
|
}
|
|
}
|