diff --git a/settings/hyprland.nix b/settings/hyprland.nix index e8142bd..8dfc0cf 100644 --- a/settings/hyprland.nix +++ b/settings/hyprland.nix @@ -576,14 +576,6 @@ in property var activeDropdown: null - HoverHandler { - onHoveredChanged: { - if (hovered && bar.activeDropdown) { - bar.activeDropdown.resetAutoClose(); - } - } - } - function closeAllDropdowns() { if (activeDropdown && activeDropdown.visible) { activeDropdown.animateClose(); @@ -671,7 +663,12 @@ in anchors.fill: parent hoverEnabled: true 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 hoverEnabled: true 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 hoverEnabled: true 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,13 +995,16 @@ in hoverEnabled: true acceptedButtons: Qt.NoButton onEntered: { - if (bar.activeDropdown && modelData.hasMenu && !(bar.activeDropdown === contextMenu && contextMenu.trayItem === modelData)) { - bar.toggleDropdown(contextMenu, function() { - let pos = parent.mapToItem(bar.contentItem, parent.width / 2, 0); - contextMenu.dropdownX = pos.x; - contextMenu.trayItem = modelData; - menuOpener.menu = modelData.menu; - }); + if (bar.activeDropdown) { + bar.activeDropdown.resetAutoClose(); + if (modelData.hasMenu && !(bar.activeDropdown === contextMenu && contextMenu.trayItem === modelData)) { + bar.toggleDropdown(contextMenu, function() { + let pos = parent.mapToItem(bar.contentItem, parent.width / 2, 0); + contextMenu.dropdownX = pos.x; + contextMenu.trayItem = modelData; + menuOpener.menu = modelData.menu; + }); + } } } }