mirror of
https://github.com/noctalia-dev/noctalia-shell.git
synced 2026-05-11 17:08:27 +08:00
Feat: Now freezes the notifications when hovering on notifications buttons too.
This commit is contained in:
@@ -248,24 +248,40 @@ Variants {
|
||||
// Staggered animation delay based on index
|
||||
readonly property int animationDelay: index * 100
|
||||
|
||||
property int hoverCount: 0
|
||||
|
||||
onHoverCountChanged: {
|
||||
if (hoverCount > 0) {
|
||||
resumeTimer.stop()
|
||||
NotificationService.pauseTimeout(notificationId)
|
||||
} else {
|
||||
resumeTimer.start()
|
||||
}
|
||||
}
|
||||
|
||||
Timer {
|
||||
id: resumeTimer
|
||||
interval: 50
|
||||
repeat: false
|
||||
onTriggered: {
|
||||
if (hoverCount === 0) {
|
||||
NotificationService.resumeTimeout(notificationId)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Right-click to dismiss
|
||||
MouseArea {
|
||||
anchors.fill: parent
|
||||
acceptedButtons: Qt.RightButton
|
||||
hoverEnabled: true
|
||||
onEntered: parent.hoverCount++
|
||||
onExited: parent.hoverCount--
|
||||
onClicked: {
|
||||
if (mouse.button === Qt.RightButton) {
|
||||
animateOut()
|
||||
}
|
||||
}
|
||||
|
||||
onContainsMouseChanged: {
|
||||
if (containsMouse) {
|
||||
NotificationService.pauseTimeout(notificationId)
|
||||
} else {
|
||||
NotificationService.resumeTimeout(notificationId)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Scale, fade, and slide animation
|
||||
@@ -493,6 +509,9 @@ Variants {
|
||||
delegate: NButton {
|
||||
property var actionData: modelData
|
||||
|
||||
onEntered: card.hoverCount++
|
||||
onExited: card.hoverCount--
|
||||
|
||||
text: {
|
||||
var actionText = actionData.text || "Open"
|
||||
// If text contains comma, take the part after the comma (the display text)
|
||||
|
||||
@@ -25,6 +25,8 @@ Rectangle {
|
||||
signal clicked
|
||||
signal rightClicked
|
||||
signal middleClicked
|
||||
signal entered
|
||||
signal exited
|
||||
|
||||
// Internal properties
|
||||
property bool hovered: false
|
||||
@@ -140,12 +142,14 @@ Rectangle {
|
||||
|
||||
onEntered: {
|
||||
root.hovered = true
|
||||
root.entered()
|
||||
if (tooltipText) {
|
||||
TooltipService.show(Screen, root, root.tooltipText)
|
||||
}
|
||||
}
|
||||
onExited: {
|
||||
root.hovered = false
|
||||
root.exited()
|
||||
if (tooltipText) {
|
||||
TooltipService.hide()
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user