From 416146735641647511f1c88673e83ebdd323875c Mon Sep 17 00:00:00 2001 From: Runze Date: Wed, 6 Aug 2025 01:31:02 +0800 Subject: [PATCH] use PanelWindow instead to show animation --- .../ii/modules/bar/BatteryIndicator.qml | 27 +++++++++++++------ 1 file changed, 19 insertions(+), 8 deletions(-) diff --git a/.config/quickshell/ii/modules/bar/BatteryIndicator.qml b/.config/quickshell/ii/modules/bar/BatteryIndicator.qml index ae907e42e..3cad9b2a5 100644 --- a/.config/quickshell/ii/modules/bar/BatteryIndicator.qml +++ b/.config/quickshell/ii/modules/bar/BatteryIndicator.qml @@ -95,23 +95,34 @@ MouseArea { } } - LazyLoader { + Loader { id: popupLoader active: root.containsMouse - component: PopupWindow { + sourceComponent: PanelWindow { id: popupWindow visible: true + color: "transparent" + exclusiveZone: 0 + + anchors.top: true + anchors.left: true + implicitWidth: batteryPopup.implicitWidth implicitHeight: batteryPopup.implicitHeight - anchor.item: root - anchor.rect.x: (root.implicitWidth - popupWindow.implicitWidth) / 2 - anchor.rect.y: Config.options.bar.bottom - ? (-batteryPopup.implicitHeight - 15) - : (root.implicitHeight + 15) - color: "transparent" + + margins { + left: root.mapToGlobal(Qt.point(0, 0)).x - batteryPopup.implicitWidth / 3 + top: root.mapToGlobal(Qt.point(0, root.height)).y - 30 + } + + mask: Region { + item: batteryPopup + } + BatteryPopup { id: batteryPopup + anchors.centerIn: parent } } }