From ae3d7efc6e1f12fa8bbc489e25108cd6fa40ed23 Mon Sep 17 00:00:00 2001 From: David Heinemeier Hansson Date: Sat, 16 May 2026 22:48:56 +0200 Subject: [PATCH] Better weather placement --- .../plugins/bar/common/PopupCard.qml | 17 +++++++++++++++++ .../plugins/bar/widgets/weatherFlyout.qml | 1 + 2 files changed, 18 insertions(+) diff --git a/default/quickshell/omarchy-shell/plugins/bar/common/PopupCard.qml b/default/quickshell/omarchy-shell/plugins/bar/common/PopupCard.qml index 07ac7b9a..9c2c901a 100644 --- a/default/quickshell/omarchy-shell/plugins/bar/common/PopupCard.qml +++ b/default/quickshell/omarchy-shell/plugins/bar/common/PopupCard.qml @@ -14,6 +14,7 @@ PopupWindow { property int contentWidth: 280 property int contentHeight: 200 property bool open: false + property bool centerOnBar: false // "click" — uses HyprlandFocusGrab so clicking outside dismisses the popup. // "hover" — passive overlay; the owning widget controls open via hover. property string triggerMode: "click" @@ -81,6 +82,22 @@ PopupWindow { var window = target.QsWindow.window if (!window) return + if (root.centerOnBar) { + if (root.bar.position === "top" || root.bar.position === "bottom") { + localX = window.width / 2 - popupWidth / 2 + localY = root.bar.position === "bottom" ? -popupHeight - root.margin : window.height + root.margin + localX = Math.max(root.margin, Math.min(localX, window.width - popupWidth - root.margin)) + } else { + localX = root.bar.position === "left" ? window.width + root.margin : -popupWidth - root.margin + localY = window.height / 2 - popupHeight / 2 + localY = Math.max(root.margin, Math.min(localY, window.height - popupHeight - root.margin)) + } + + popupAnchor.rect.x = Math.round(localX) + popupAnchor.rect.y = Math.round(localY) + return + } + if (root.bar.position === "top" || root.bar.position === "bottom") { localX = Math.max(root.margin, Math.min(localX, window.width - popupWidth - root.margin)) } else { diff --git a/default/quickshell/omarchy-shell/plugins/bar/widgets/weatherFlyout.qml b/default/quickshell/omarchy-shell/plugins/bar/widgets/weatherFlyout.qml index b573195f..d152a153 100644 --- a/default/quickshell/omarchy-shell/plugins/bar/widgets/weatherFlyout.qml +++ b/default/quickshell/omarchy-shell/plugins/bar/widgets/weatherFlyout.qml @@ -178,6 +178,7 @@ Item { owner: root bar: root.bar open: root.popupOpen + centerOnBar: true triggerMode: "click" contentWidth: 440 contentHeight: card.implicitHeight + 28