quickshell: fix tray hover switching same contextMenu dropdown

When hovering between tray icons, update menu content in-place
instead of calling toggleDropdown which closes the visible menu.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
rope 2026-05-26 21:15:39 +01:00
parent 656a1fa4ed
commit 5e72fdf038

View file

@ -1007,6 +1007,14 @@ in
if (bar.activeDropdown) { if (bar.activeDropdown) {
bar.activeDropdown.resetAutoClose(); bar.activeDropdown.resetAutoClose();
if (modelData.hasMenu && !(bar.activeDropdown === contextMenu && contextMenu.trayItem === modelData)) { if (modelData.hasMenu && !(bar.activeDropdown === contextMenu && contextMenu.trayItem === modelData)) {
if (bar.activeDropdown === contextMenu) {
// Same dropdown, just switch content
let pos = parent.mapToItem(bar.contentItem, parent.width / 2, 0);
contextMenu.dropdownX = pos.x;
contextMenu.trayItem = modelData;
menuOpener.menu = modelData.menu;
contextMenu.resetAutoClose();
} else {
bar.toggleDropdown(contextMenu, function() { bar.toggleDropdown(contextMenu, function() {
let pos = parent.mapToItem(bar.contentItem, parent.width / 2, 0); let pos = parent.mapToItem(bar.contentItem, parent.width / 2, 0);
contextMenu.dropdownX = pos.x; contextMenu.dropdownX = pos.x;
@ -1017,6 +1025,7 @@ in
} }
} }
} }
}
MouseArea { MouseArea {
anchors.fill: parent anchors.fill: parent
acceptedButtons: Qt.LeftButton | Qt.RightButton acceptedButtons: Qt.LeftButton | Qt.RightButton