feat: refactor notification system to manage hover states centrally and auto close
This commit is contained in:
@@ -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)
|
||||
// }
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user