From 8a721d4270d88a436ebefa9c02bd751348851ddf Mon Sep 17 00:00:00 2001 From: Lemmy Date: Wed, 28 Jan 2026 16:48:23 -0500 Subject: [PATCH] tray: more tooltip fixes --- Modules/Bar/Widgets/Tray.qml | 2 +- Services/UI/TooltipService.qml | 22 ++++++++++++++++------ Widgets/NIconButton.qml | 4 ++-- 3 files changed, 19 insertions(+), 9 deletions(-) diff --git a/Modules/Bar/Widgets/Tray.qml b/Modules/Bar/Widgets/Tray.qml index 33770c964..7742ed875 100644 --- a/Modules/Bar/Widgets/Tray.qml +++ b/Modules/Bar/Widgets/Tray.qml @@ -444,7 +444,7 @@ Item { TooltipService.show(tooltipAnchor, modelData.tooltipTitle || modelData.name || modelData.id || "Tray Item", BarService.getTooltipDirection(root.screen?.name)); } else if (root.hoveredItemIndex === trayDelegate.index) { root.hoveredItemIndex = -1; - TooltipService.hide(); + TooltipService.hide(tooltipAnchor); } } onClicked: mouse => { diff --git a/Services/UI/TooltipService.qml b/Services/UI/TooltipService.qml index 6f772c35c..485d13f33 100644 --- a/Services/UI/TooltipService.qml +++ b/Services/UI/TooltipService.qml @@ -88,12 +88,22 @@ Singleton { return null; } - function hide() { - if (pendingTooltip) { - pendingTooltip.hide(); - } - if (activeTooltip) { - activeTooltip.hide(); + function hide(target) { + // If target is provided, only hide if tooltip belongs to that target + if (target) { + if (pendingTooltip && pendingTooltip.targetItem === target) { + pendingTooltip.hide(); + } + if (activeTooltip && activeTooltip.targetItem === target) { + activeTooltip.hide(); + } + } else { + if (pendingTooltip) { + pendingTooltip.hide(); + } + if (activeTooltip) { + activeTooltip.hide(); + } } } diff --git a/Widgets/NIconButton.qml b/Widgets/NIconButton.qml index dc191cfeb..d5bc45dfb 100644 --- a/Widgets/NIconButton.qml +++ b/Widgets/NIconButton.qml @@ -103,13 +103,13 @@ Item { onExited: { hovering = false; if (tooltipText) { - TooltipService.hide(); + TooltipService.hide(root); } root.exited(); } onClicked: function (mouse) { if (tooltipText) { - TooltipService.hide(); + TooltipService.hide(root); } if (!root.enabled && !allowClickWhenDisabled) { return;