feat: refactor notification system to manage hover states centrally and auto close

This commit is contained in:
Hannes
2026-09-02 00:16:15 +02:00
parent b59eb012ba
commit 27401c25a0
5 changed files with 129 additions and 25 deletions
+9
View File
@@ -84,3 +84,12 @@ PanelWindow {
}
}
}
76 closeNHistory()
157 notificationPopupEnabled
169 notificationPopupEnabled
206, 207 ^^
+13 -11
View File
@@ -13,11 +13,20 @@ MouseArea {
cursorShape: Qt.PointingHandCursor
onClicked: {
// NotificationS.soundEnabled = !NotificationS.soundEnabled
// NotificationS.notificationPopupEnabled = !NotificationS.notificationPopupEnabled
console.log("[NotificationButton] Opening NotificationHistory")
root.toggleNotificationHistory()
}
// ── Report hover to NotificationServer for auto-close logic ──
onContainsMouseChanged: NotificationS.buttonHovered = containsMouse
Component.onDestruction: {
if (containsMouse) NotificationS.buttonHovered = false
}
onVisibleChanged: {
if (!visible && NotificationS.buttonHovered) NotificationS.buttonHovered = false
}
Item {
anchors.top: parent.topBar
@@ -37,7 +46,7 @@ MouseArea {
color: Colors.secondaryContainer_fg
}
}
Rectangle {
anchors.fill: parent
color: "transparent"
@@ -46,18 +55,11 @@ MouseArea {
Text {
id: notificationText
anchors.centerIn: parent
// text: Quickshell.iconPath("discord")
text: NotificationS.soundEnabled ? "󰂚" : "󰂛"
// text: Quickshell.iconPath("discord")
text: NotificationS.notificationPopupEnabled ? "󰂚" : "󰂛"
font.pixelSize: Config.bigIconSize(bar.height)
font.family: Config.font
color: Colors.secondaryContainer_fg
}
// Image{
// id: iconImage
// source: Quickshell.iconPath("discord")
// width: Config.bigIconSize(notificationButton.height)
// height: Config.bigIconSize(notificationButton.height)
// }
}
}