quickshell: stop discarding the tray menu on close

contextMenu nulled menuOpener.menu whenever it hid, throwing away the
loaded items. The only thing that refills them is the hover prefetch,
which fires on enter — and the cursor is already on the icon you just
clicked, so closing and reopening never re-triggered it. The reopen
re-fetched over DBus and the panel grew to its empty height, then
jumped when the items arrived. Moving to another widget and back
worked only because it produced a fresh hover-enter.

Keeping the handle assigned makes reopening the same item free, and
since assigning an unchanged QML property is a no-op it also covers
switching away and back. openFor() reassigns for a different item.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
This commit is contained in:
rope 2026-07-28 14:58:54 +01:00
parent 105066c7c4
commit 196b71bf25

View file

@ -2110,9 +2110,14 @@ in
fullWidth: menuItems.width + 2 * Theme.panelGap
fullHeight: menuItems.height + 2 * Theme.panelGap
onVisibleChanged: {
if (!visible) menuOpener.menu = null;
}
// Deliberately NOT cleared on close. Nulling the menu threw
// away the loaded items, and the only thing that refills
// them is a hover-enter which never fires if the cursor
// is still sitting on the icon you just clicked. Reopening
// then re-fetched over DBus and the panel grew to its empty
// height first, then jumped once the items landed. Keeping
// the handle assigned makes reopening the same item free;
// openFor() reassigns it when you pick a different one.
QsMenuOpener {
id: menuOpener