53 lines
1.3 KiB
QML
53 lines
1.3 KiB
QML
pragma ComponentBehavior: Bound
|
|
import Quickshell.Services.Mpris
|
|
import QtQuick
|
|
import QtQuick.Layouts
|
|
import QtQuick.Effects
|
|
import Quickshell
|
|
import Quickshell.Widgets
|
|
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
|
|
active: clickHandler.containsMouse
|
|
RowLayout {
|
|
id: songLayout
|
|
anchors.centerIn: root
|
|
IconImage {
|
|
source: Quickshell.iconPath("folder-music-symbolic")
|
|
implicitSize: Config.iconSize
|
|
layer.enabled: true
|
|
layer.effect: MultiEffect {
|
|
colorization: 1.0
|
|
colorizationColor: Colors.text
|
|
brightness: 0.5
|
|
}
|
|
}
|
|
StyledText {
|
|
Layout.maximumWidth: 400
|
|
Layout.maximumHeight: Config.barHeight / 1.6
|
|
text: root.spotify?.trackTitle + " - " + root.spotify?.trackArtists
|
|
elide: Text.ElideRight
|
|
}
|
|
}
|
|
MouseArea {
|
|
id: clickHandler
|
|
anchors.fill: root
|
|
hoverEnabled: true
|
|
onClicked: root.spotify.togglePlaying()
|
|
acceptedButtons: Qt.LeftButton
|
|
cursorShape: Qt.PointingHandCursor
|
|
}
|
|
}
|