From 0beee14cd88397aefab39561a68be57ff4fdd5e6 Mon Sep 17 00:00:00 2001 From: end-4 <97237370+end-4@users.noreply.github.com> Date: Mon, 11 Aug 2025 15:52:54 +0700 Subject: [PATCH] bar: popups: fix and simplify positioning --- .../ii/modules/bar/BatteryIndicator.qml | 2 -- .../quickshell/ii/modules/bar/ClockWidget.qml | 1 - .../quickshell/ii/modules/bar/Resource.qml | 1 - .../ii/modules/bar/weather/WeatherBar.qml | 1 - .../ii/modules/common/widgets/StyledPopup.qml | 30 +++++++------------ 5 files changed, 10 insertions(+), 25 deletions(-) diff --git a/.config/quickshell/ii/modules/bar/BatteryIndicator.qml b/.config/quickshell/ii/modules/bar/BatteryIndicator.qml index 39388aaf..d2f17e59 100644 --- a/.config/quickshell/ii/modules/bar/BatteryIndicator.qml +++ b/.config/quickshell/ii/modules/bar/BatteryIndicator.qml @@ -97,8 +97,6 @@ MouseArea { StyledPopup { hoverTarget: root - offsetY: -30 - maskEnabled: true contentComponent: BatteryPopup { id: batteryPopup anchors.centerIn: parent diff --git a/.config/quickshell/ii/modules/bar/ClockWidget.qml b/.config/quickshell/ii/modules/bar/ClockWidget.qml index 25e5a5eb..c7ffeed3 100644 --- a/.config/quickshell/ii/modules/bar/ClockWidget.qml +++ b/.config/quickshell/ii/modules/bar/ClockWidget.qml @@ -48,7 +48,6 @@ Item { StyledPopup { hoverTarget: mouseArea - offsetY: -30 contentComponent: Rectangle { id: datePopup readonly property real margin: 12 diff --git a/.config/quickshell/ii/modules/bar/Resource.qml b/.config/quickshell/ii/modules/bar/Resource.qml index 031a77ed..a352e0eb 100644 --- a/.config/quickshell/ii/modules/bar/Resource.qml +++ b/.config/quickshell/ii/modules/bar/Resource.qml @@ -70,7 +70,6 @@ Item { StyledPopup { hoverTarget: mouseArea - offsetY: -30 contentComponent: Rectangle { id: resourcePopup readonly property real margin: 10 diff --git a/.config/quickshell/ii/modules/bar/weather/WeatherBar.qml b/.config/quickshell/ii/modules/bar/weather/WeatherBar.qml index b547ad0e..8339d482 100644 --- a/.config/quickshell/ii/modules/bar/weather/WeatherBar.qml +++ b/.config/quickshell/ii/modules/bar/weather/WeatherBar.qml @@ -38,7 +38,6 @@ MouseArea { StyledPopup { hoverTarget: root - offsetY: -25 contentComponent: WeatherPopup { id: weatherPopup anchors.centerIn: parent diff --git a/.config/quickshell/ii/modules/common/widgets/StyledPopup.qml b/.config/quickshell/ii/modules/common/widgets/StyledPopup.qml index 5a72d121..df5bdec1 100644 --- a/.config/quickshell/ii/modules/common/widgets/StyledPopup.qml +++ b/.config/quickshell/ii/modules/common/widgets/StyledPopup.qml @@ -11,8 +11,6 @@ LazyLoader { id: root property Item hoverTarget - property real offsetY: -30 - property bool maskEnabled: true property Component contentComponent active: hoverTarget && hoverTarget.containsMouse @@ -22,33 +20,25 @@ LazyLoader { visible: true color: "transparent" exclusiveZone: 0 - anchors.top: true + anchors.left: true + anchors.top: !Config.options.bar.bottom + anchors.bottom: Config.options.bar.bottom implicitWidth: popupContent.implicitWidth implicitHeight: popupContent.implicitHeight margins { - left: hoverTarget - ? hoverTarget.mapToGlobal(Qt.point( - (hoverTarget.width - popupContent.implicitWidth) / 2, - 0 - )).x - : 0 - top: hoverTarget - ? hoverTarget.mapToGlobal(Qt.point(0, hoverTarget.height)).y + offsetY - : 0 + left: root.QsWindow?.mapFromItem( + root.hoverTarget, + (root.hoverTarget.width - popupContent.implicitWidth) / 2, 0 + ).x + top: Appearance.sizes.hyprlandGapsOut + bottom: Appearance.sizes.hyprlandGapsOut } - - mask: maskEnabled ? popupMask : undefined - WlrLayershell.namespace: "quickshell:styledPopup" //maybe this can fix with the popups not showing ? + WlrLayershell.namespace: "quickshell:popup" //maybe this can fix with the popups not showing ? WlrLayershell.layer: WlrLayer.Overlay - Region { - id: popupMask - item: popupContent - } - Loader { id: popupContent sourceComponent: root.contentComponent