35 lines
965 B
QML
35 lines
965 B
QML
pragma ComponentBehavior: Bound
|
|
import Quickshell.Services.Mpris
|
|
import QtQuick
|
|
import QtQuick.Layouts
|
|
import QtQuick.Effects
|
|
import qs
|
|
import qs.widgets
|
|
import qs.settings
|
|
|
|
BarComponent {
|
|
id: root
|
|
implicitHeight: Config.moduleHeight
|
|
implicitWidth: songLayout.implicitWidth + 16
|
|
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
|
|
RowLayout {
|
|
id: songLayout
|
|
anchors.centerIn: root
|
|
MaterialIcon {
|
|
text: "music_note_2"
|
|
}
|
|
StyledText {
|
|
Layout.maximumWidth: 400
|
|
Layout.maximumHeight: Config.barHeight / 1.6
|
|
text: root.spotify?.trackTitle + " - " + root.spotify?.trackArtists
|
|
elide: Text.ElideRight
|
|
}
|
|
}
|
|
}
|