diff options
| -rw-r--r-- | bar/Mpris.qml | 33 |
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 + } + } } |
