From 7b5ee719c47b29277bb0fc5e3bc9e9df5e7240dd Mon Sep 17 00:00:00 2001 From: Zacharias-Brohn Date: Tue, 28 Oct 2025 19:20:27 +0100 Subject: [PATCH] fixed destroying menu on focus loss --- Modules/TrayItem.qml | 9 +++++++++ Modules/TrayMenu.qml | 20 ++++++++++---------- 2 files changed, 19 insertions(+), 10 deletions(-) diff --git a/Modules/TrayItem.qml b/Modules/TrayItem.qml index 35f5825..c1d3e8e 100644 --- a/Modules/TrayItem.qml +++ b/Modules/TrayItem.qml @@ -6,6 +6,7 @@ import QtQuick.Effects import Caelestia import Quickshell import Quickshell.Widgets +import Quickshell.Hyprland import Quickshell.Services.SystemTray import qs.Modules @@ -53,6 +54,13 @@ MouseArea { anchor.margins { left: -270 } + HyprlandFocusGrab { + id: grab + windows: [ trayMenu ] + onCleared: { + trayMenu.visible = false; + } + } } } @@ -61,6 +69,7 @@ MouseArea { root.item.activate(); } else if ( mouse.button === Qt.RightButton ) { trayMenu.visible = !trayMenu.visible; + grab.active = true; } } } diff --git a/Modules/TrayMenu.qml b/Modules/TrayMenu.qml index 4b7feef..1576915 100644 --- a/Modules/TrayMenu.qml +++ b/Modules/TrayMenu.qml @@ -20,17 +20,17 @@ PopupWindow { menu: root.menu } - HyprlandFocusGrab { - id: grab - windows: [ root ] - onCleared: { - root.visible = false; - } - } + // HyprlandFocusGrab { + // id: grab + // windows: [ root ] + // onCleared: { + // root.visible = false; + // } + // } - onVisibleChanged: { - grab.active = root.visible; - } + // onVisibleChanged: { + // grab.active = root.visible; + // } Rectangle { id: menuRect anchors.fill: parent