diff options
| -rw-r--r-- | bar/Mpris.qml | 24 | ||||
| -rw-r--r-- | config/Bar.qml | 1 |
2 files changed, 23 insertions, 2 deletions
diff --git a/bar/Mpris.qml b/bar/Mpris.qml index e2f0e7b..f922120 100644 --- a/bar/Mpris.qml +++ b/bar/Mpris.qml @@ -24,7 +24,7 @@ Item { IRect { id: rect anchors.verticalCenter: parent.verticalCenter - implicitWidth: layout.width + General.rectMargin * 4 + implicitWidth: (layout.width + General.rectMargin * 4) * (mouseArea.containsMouse ? Bar.hoverScale : 1.0) height: parent.height - General.rectMargin radius: Style.rounding.smaller color: "transparent" @@ -65,9 +65,11 @@ Item { // } MouseArea { + id: mouseArea anchors.fill: parent acceptedButtons: Qt.MiddleButton | Qt.RightButton | Qt.LeftButton cursorShape: Qt.PointingHandCursor + hoverEnabled: true onClicked: mouse => { if (mouse.button === Qt.MiddleButton) root.activePlayer?.togglePlaying(); @@ -82,8 +84,18 @@ Item { RowLayout { id: layout - anchors.centerIn: parent + + x: (parent.width - width) / 2 + y: (parent.height - height) / 2 spacing: Bar.resourceIconTextSpacing / 1.5 + + Behavior on x { + ISpringAnimation { + spring: General.springAnimationSpring * 2 + damping: General.springAnimationDamping * 1.3 + } + } + Item { Layout.preferredWidth: childrenRect.width Layout.preferredHeight: childrenRect.height @@ -169,10 +181,18 @@ Item { duration: General.animationDuration / 4 } } + Behavior on width { ISpringAnimation { spring: General.springAnimationSpring * 2 damping: General.springAnimationDamping * 1.3 } } + + Behavior on implicitWidth { + ISpringAnimation { + spring: General.springAnimationSpring * 2 + damping: General.springAnimationDamping * 1.3 + } + } } diff --git a/config/Bar.qml b/config/Bar.qml index fb71776..5506fa0 100644 --- a/config/Bar.qml +++ b/config/Bar.qml @@ -38,6 +38,7 @@ Singleton { readonly property double mediaPausedOpacity: 0.75 readonly property double mediaScrollScale: 1 / 25 // 5sec + readonly property double hoverScale: 1.2 readonly property string preferedPlayer: "spotify" readonly property double bgTransparency: 0.25 |
