From 155d9fa79580f7058f30e87df947561d89118c66 Mon Sep 17 00:00:00 2001 From: rope Date: Tue, 26 May 2026 17:41:34 +0100 Subject: [PATCH] quickshell: fix tray icon right-click by splitting MouseAreas Hover-only MouseArea (Qt.NoButton) for switch-on-hover, separate click MouseArea for right-click menus. Prevents hover tracking from consuming click events. Co-Authored-By: Claude Opus 4.6 --- settings/hyprland.nix | 26 +++++++++++++++----------- 1 file changed, 15 insertions(+), 11 deletions(-) diff --git a/settings/hyprland.nix b/settings/hyprland.nix index 5f9fe88..905e6cb 100644 --- a/settings/hyprland.nix +++ b/settings/hyprland.nix @@ -864,8 +864,22 @@ in MouseArea { anchors.fill: parent - acceptedButtons: Qt.LeftButton | Qt.RightButton 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; + }); + } + } + } + MouseArea { + anchors.fill: parent + acceptedButtons: Qt.LeftButton | Qt.RightButton onClicked: (event) => { if (event.button === Qt.RightButton && modelData.hasMenu) { bar.toggleDropdown(contextMenu, function() { @@ -878,16 +892,6 @@ in modelData.activate(); } } - 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; - }); - } - } } } }