fix: autoclose only when not hovered

This commit is contained in:
Hannes
2026-09-02 00:27:32 +02:00
parent a827d1e92c
commit 8eb08631f7
2 changed files with 48 additions and 28 deletions
+14 -1
View File
@@ -1,6 +1,7 @@
import QtQuick
import Quickshell
import "../../config"
import "./notificationServer"
import QtQuick.Layouts
import QtQuick.Controls
@@ -46,6 +47,18 @@ Rectangle {
property color textColor: urgency != 3 ? Colors.primary : Colors.tertiary
property color textBGColor: urgency != 3 ? Qt.alpha(Colors.primaryContainer, 0.75) : Qt.alpha(Colors.tertiaryContainer, 0.75)
// Expose hover state for history auto-close (reuse paused logic)
readonly property bool isHovered: mouseArea.containsMouse || closingMouseArea.containsMouse || inlineReplyButtonMouseArea.containsMouse || _hoveredActionCount > 0 || inlineReplyTextField.hovered || inlineReplyTextField.activeFocus
HoverHandler {
enabled: root.isHistory
blocking: false
grabPermissions: PointerHandler.CanTakeOverFromAnything
onHoveredChanged: if (hovered) NotificationS.historyHovered = true
}
// When in history, also keep historyHovered true while any inner element is hovered
onIsHoveredChanged: if (isHistory && isHovered) NotificationS.historyHovered = true
function closeNotification(dismiss){
if (closing) {
return
@@ -420,7 +433,7 @@ Rectangle {
from: 1.0
to: 0.0
duration: root.duration
paused: (mouseArea.containsMouse || closingMouseArea.containsMouse || inlineReplyButtonMouseArea.containsMouse || root._hoveredActionCount > 0 || inlineReplyTextField.hovered || inlineReplyTextField.activeFocus) && !isHistory
paused: isHovered && !isHistory
onFinished: root.closeNotification(false)
}
}