quickshell: reset auto-close timer when hovering between widgets

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
rope 2026-05-26 21:06:16 +01:00
parent 526f673f7d
commit 05ada14442

View file

@ -576,14 +576,6 @@ in
property var activeDropdown: null property var activeDropdown: null
HoverHandler {
onHoveredChanged: {
if (hovered && bar.activeDropdown) {
bar.activeDropdown.resetAutoClose();
}
}
}
function closeAllDropdowns() { function closeAllDropdowns() {
if (activeDropdown && activeDropdown.visible) { if (activeDropdown && activeDropdown.visible) {
activeDropdown.animateClose(); activeDropdown.animateClose();
@ -671,7 +663,12 @@ in
anchors.fill: parent anchors.fill: parent
hoverEnabled: true hoverEnabled: true
onClicked: bar.toggleDropdown(calPopup) onClicked: bar.toggleDropdown(calPopup)
onEntered: { if (bar.activeDropdown && bar.activeDropdown !== calPopup) bar.toggleDropdown(calPopup); } onEntered: {
if (bar.activeDropdown) {
if (bar.activeDropdown !== calPopup) bar.toggleDropdown(calPopup);
else bar.activeDropdown.resetAutoClose();
}
}
} }
} }
@ -816,7 +813,12 @@ in
anchors.fill: parent anchors.fill: parent
hoverEnabled: true hoverEnabled: true
onClicked: netWidget.openNetDropdown() onClicked: netWidget.openNetDropdown()
onEntered: { if (bar.activeDropdown && bar.activeDropdown !== netDropdown) netWidget.openNetDropdown(); } onEntered: {
if (bar.activeDropdown) {
if (bar.activeDropdown !== netDropdown) netWidget.openNetDropdown();
else bar.activeDropdown.resetAutoClose();
}
}
} }
} }
@ -947,7 +949,12 @@ in
anchors.fill: parent anchors.fill: parent
hoverEnabled: true hoverEnabled: true
onClicked: batteryWidget.openBatteryDropdown() onClicked: batteryWidget.openBatteryDropdown()
onEntered: { if (bar.activeDropdown && bar.activeDropdown !== batteryDropdown) batteryWidget.openBatteryDropdown(); } onEntered: {
if (bar.activeDropdown) {
if (bar.activeDropdown !== batteryDropdown) batteryWidget.openBatteryDropdown();
else bar.activeDropdown.resetAutoClose();
}
}
} }
} }
''} ''}
@ -988,7 +995,9 @@ in
hoverEnabled: true hoverEnabled: true
acceptedButtons: Qt.NoButton acceptedButtons: Qt.NoButton
onEntered: { onEntered: {
if (bar.activeDropdown && modelData.hasMenu && !(bar.activeDropdown === contextMenu && contextMenu.trayItem === modelData)) { if (bar.activeDropdown) {
bar.activeDropdown.resetAutoClose();
if (modelData.hasMenu && !(bar.activeDropdown === contextMenu && contextMenu.trayItem === modelData)) {
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;
@ -998,6 +1007,7 @@ in
} }
} }
} }
}
MouseArea { MouseArea {
anchors.fill: parent anchors.fill: parent
acceptedButtons: Qt.LeftButton | Qt.RightButton acceptedButtons: Qt.LeftButton | Qt.RightButton