summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorlittleblack111 <littleblack11111@gmail.com>2025-07-15 15:28:18 +0800
committerlittleblack111 <littleblack11111@gmail.com>2025-07-15 15:28:18 +0800
commit7b25e6f3a79d9729c3851dbaf0540710126a5f81 (patch)
treed6ebffa0e6f6df208fb3089c14312f61cc98498c
parentd7c4aaecd05dc67e4bb3c88624e1a48b57c4a90a (diff)
mpris: trackart
mpris: animation
-rw-r--r--bar/Mpris.qml33
1 files changed, 28 insertions, 5 deletions
diff --git a/bar/Mpris.qml b/bar/Mpris.qml
index 1f94e88..eca0091 100644
--- a/bar/Mpris.qml
+++ b/bar/Mpris.qml
@@ -1,6 +1,7 @@
-import QtQuick 2.15
-import QtQuick.Layouts 1.15
+import QtQuick
+import QtQuick.Layouts
import Quickshell
+import Quickshell.Widgets
import Quickshell.Services.Mpris
import qs.services as Services
import qs.config
@@ -26,9 +27,12 @@ Item {
return title.trim();
}
- implicitWidth: rect.width - General.rectMargin / 1.25
+ implicitWidth: activePlayer ? rect.width - General.rectMargin / 1.25 : 0
height: Bar.height + General.rectMargin / 1.5
+ // TODO: after support for multiple players is added, this should be changed to if none exist/is active
+ opacity: activePlayer ? 1 : 0
+
Rectangle {
id: rect
anchors.verticalCenter: parent.verticalCenter
@@ -41,8 +45,14 @@ Item {
id: layout
anchors.centerIn: parent
spacing: Bar.resourceIconTextSpacing / 1.5
- Icon {
- text: root.state
+ // Icon {
+ // text: root.state
+ // }
+ Image {
+ source: activePlayer.trackArtUrl
+ fillMode: Image.PreserveAspectFit
+ Layout.preferredWidth: Bar.appIconSize
+ cache: true
}
IText {
animate: true
@@ -171,4 +181,17 @@ Item {
}
}
}
+
+ Behavior on opacity {
+ NumberAnimation {
+ duration: General.animateDuration / 4
+ }
+ }
+
+ Behavior on implicitWidth {
+ ISpringAnimation {
+ spring: General.springAnimationSpring * 2
+ damping: General.springAnimationDamping * 1.3
+ }
+ }
}