From db144ea05a98051662b4d77a2a0dfd950d670295 Mon Sep 17 00:00:00 2001 From: "Danilo M." Date: Sat, 24 Oct 2026 09:44:39 +0200 Subject: island: release the tray-menu hold when the menu closes A tray menu un-hovers the pills, so the island holds itself shown while one is open. display() reports no close, so the hold ended only when the pointer came back to the island. Quitting an app from its menu left the pointer on the vanished menu, below the pills, and the island stayed open until the next hover. Menus now open through a QsMenuAnchor. Its closed signal fires on any dismissal, an entry picked, Escape or a click elsewhere, and clears the hold and restarts the hide timer. Checked by eye: menu placement unchanged, Quit and a dismissal both retract the island, hovering back keeps it shown. Co-Authored-By: Claude Opus 5.5 --- desktop/island/StatusPill.qml | 17 +++++++++++++++-- 1 file changed, 15 insertions(+), 2 deletions(-) (limited to 'desktop/island/StatusPill.qml') diff --git a/desktop/island/StatusPill.qml b/desktop/island/StatusPill.qml index 915807b..99f1512 100644 --- a/desktop/island/StatusPill.qml +++ b/desktop/island/StatusPill.qml @@ -38,8 +38,17 @@ Capsule { signal openHeadphones() signal closePanel() signal openDrawer() - // Emitted just before a tray menu opens; the menu cannot report its close. + // A tray menu opening and closing. display() reports no close, so menus + // open through a QsMenuAnchor, whose closed fires on any dismissal: an + // entry picked (Quit included), Escape or a click elsewhere. signal menuShown() + signal menuClosed() + + QsMenuAnchor { + id: menuAnchor + anchor.window: pill.window + onClosed: pill.menuClosed() + } expanded: panel === "sound" || panel === "headphones" restWidth: restRow.implicitWidth + 24 @@ -100,8 +109,12 @@ Capsule { if (!wantsMenu) { item.activate(); return; } if (!item.hasMenu) return; const p = trayIcon.mapToItem(null, 0, trayIcon.height + 6); + if (menuAnchor.visible) menuAnchor.close(); + menuAnchor.menu = item.menu; + menuAnchor.anchor.rect.x = p.x; + menuAnchor.anchor.rect.y = p.y; pill.menuShown(); - item.display(pill.window, p.x, p.y); + menuAnchor.open(); } } } -- cgit v1.2.3