Compare commits
4
Commits
b59eb012ba
...
aea40a3e42
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
aea40a3e42 | ||
|
|
8eb08631f7 | ||
|
|
a827d1e92c | ||
|
|
27401c25a0 |
+1
-1
@@ -83,4 +83,4 @@ PanelWindow {
|
|||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -13,11 +13,20 @@ MouseArea {
|
|||||||
cursorShape: Qt.PointingHandCursor
|
cursorShape: Qt.PointingHandCursor
|
||||||
|
|
||||||
onClicked: {
|
onClicked: {
|
||||||
// NotificationS.soundEnabled = !NotificationS.soundEnabled
|
// NotificationS.notificationPopupEnabled = !NotificationS.notificationPopupEnabled
|
||||||
console.log("[NotificationButton] Opening NotificationHistory")
|
console.log("[NotificationButton] Opening NotificationHistory")
|
||||||
root.toggleNotificationHistory()
|
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 {
|
Item {
|
||||||
anchors.top: parent.topBar
|
anchors.top: parent.topBar
|
||||||
@@ -37,7 +46,7 @@ MouseArea {
|
|||||||
color: Colors.secondaryContainer_fg
|
color: Colors.secondaryContainer_fg
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
Rectangle {
|
Rectangle {
|
||||||
anchors.fill: parent
|
anchors.fill: parent
|
||||||
color: "transparent"
|
color: "transparent"
|
||||||
@@ -46,18 +55,11 @@ MouseArea {
|
|||||||
Text {
|
Text {
|
||||||
id: notificationText
|
id: notificationText
|
||||||
anchors.centerIn: parent
|
anchors.centerIn: parent
|
||||||
// text: Quickshell.iconPath("discord")
|
// text: Quickshell.iconPath("discord")
|
||||||
text: NotificationS.soundEnabled ? "" : ""
|
text: NotificationS.notificationPopupEnabled ? "" : ""
|
||||||
font.pixelSize: Config.bigIconSize(bar.height)
|
font.pixelSize: Config.bigIconSize(bar.height)
|
||||||
font.family: Config.font
|
font.family: Config.font
|
||||||
color: Colors.secondaryContainer_fg
|
color: Colors.secondaryContainer_fg
|
||||||
}
|
}
|
||||||
|
|
||||||
// Image{
|
|
||||||
// id: iconImage
|
|
||||||
// source: Quickshell.iconPath("discord")
|
|
||||||
// width: Config.bigIconSize(notificationButton.height)
|
|
||||||
// height: Config.bigIconSize(notificationButton.height)
|
|
||||||
// }
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -1,6 +1,7 @@
|
|||||||
import QtQuick
|
import QtQuick
|
||||||
import Quickshell
|
import Quickshell
|
||||||
import "../../config"
|
import "../../config"
|
||||||
|
import "./notificationServer"
|
||||||
import QtQuick.Layouts
|
import QtQuick.Layouts
|
||||||
import QtQuick.Controls
|
import QtQuick.Controls
|
||||||
|
|
||||||
@@ -34,8 +35,7 @@ Rectangle {
|
|||||||
|
|
||||||
implicitWidth: screen.width/7
|
implicitWidth: screen.width/7
|
||||||
// implicitHeight: screen.height/7
|
// implicitHeight: screen.height/7
|
||||||
implicitHeight: contentRowRectangle.height+(actionRowRectangle.visible?actionRowRectangle.height:0)+(inlineReplyRectangle.visible?inlineReplyRectangle.height:0)+(progressBar.visible?progressBar
|
implicitHeight: contentRowRectangle.height+(actionRowRectangle.visible?actionRowRectangle.height:0)+(inlineReplyRectangle.visible?inlineReplyRectangle.height:0)+(progressBar.visible?progressBar.height:0)
|
||||||
.height:0)
|
|
||||||
|
|
||||||
color: textBGColor
|
color: textBGColor
|
||||||
border.width: Config.border_width
|
border.width: Config.border_width
|
||||||
@@ -46,6 +46,18 @@ Rectangle {
|
|||||||
property color textColor: urgency != 3 ? Colors.primary : Colors.tertiary
|
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)
|
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){
|
function closeNotification(dismiss){
|
||||||
if (closing) {
|
if (closing) {
|
||||||
return
|
return
|
||||||
@@ -420,7 +432,7 @@ Rectangle {
|
|||||||
from: 1.0
|
from: 1.0
|
||||||
to: 0.0
|
to: 0.0
|
||||||
duration: root.duration
|
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)
|
onFinished: root.closeNotification(false)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -31,8 +31,7 @@ PanelWindow {
|
|||||||
|
|
||||||
property var grouped: {
|
property var grouped: {
|
||||||
const vals = NotificationS.trackedNotifications.values
|
const vals = NotificationS.trackedNotifications.values
|
||||||
const len = vals.length
|
if (!vals || vals.length === 0) return []
|
||||||
if (len < 0) return []
|
|
||||||
let map = {}
|
let map = {}
|
||||||
for (let i = 0; i < vals.length; ++i) {
|
for (let i = 0; i < vals.length; ++i) {
|
||||||
const n = vals[i]
|
const n = vals[i]
|
||||||
@@ -65,21 +64,71 @@ PanelWindow {
|
|||||||
expandedGroups = ({})
|
expandedGroups = ({})
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function closeNHistory() {
|
||||||
|
// Centralized close via singleton signal – fixes previous ReferenceError
|
||||||
|
// where this file tried to access notifificationHistoryLoader.id directly
|
||||||
|
// (that id lives in NotificationHistoryLoader.qml and is not in scope here).
|
||||||
|
console.log("[NotificationHistory] closeNHistory() requested")
|
||||||
|
NotificationS.historyHovered = false
|
||||||
|
NotificationS.closeHistoryRequested()
|
||||||
|
}
|
||||||
|
|
||||||
|
// ── Hover tracking via NotificationServer ──
|
||||||
|
// History reports its hover state via background HoverHandler (non-exclusive)
|
||||||
|
// so hovering over inner buttons (closeArea, clearGroupArea, NotificationBody)
|
||||||
|
// does NOT clear historyHovered. Timer auto-closes when neither history nor
|
||||||
|
// bar button is hovered for historyAutoCloseDelay ms.
|
||||||
|
property bool _allowAutoClose: false
|
||||||
|
|
||||||
|
// Grace timer: don't allow auto-close immediately after opening,
|
||||||
|
// giving keyboard users time to move mouse to history.
|
||||||
|
Timer {
|
||||||
|
id: graceTimer
|
||||||
|
interval: 500
|
||||||
|
running: root.visible && !_allowAutoClose
|
||||||
|
repeat: false
|
||||||
|
onTriggered: _allowAutoClose = true
|
||||||
|
}
|
||||||
|
|
||||||
|
Timer {
|
||||||
|
id: hoverCloseTimer
|
||||||
|
interval: NotificationS.historyAutoCloseDelay
|
||||||
|
// Only run when panel is visible, grace passed, and neither element is hovered
|
||||||
|
running: root.visible && _allowAutoClose && !NotificationS.historyHovered && !NotificationS.buttonHovered
|
||||||
|
repeat: false
|
||||||
|
onTriggered: {
|
||||||
|
if (!NotificationS.historyHovered && !NotificationS.buttonHovered) {
|
||||||
|
console.log("[NotificationHistory] Auto-closing after hover timeout (" + interval + "ms)")
|
||||||
|
root.closeNHistory()
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// Ensure hover state is cleared when window hides/destroys
|
||||||
|
onVisibleChanged: {
|
||||||
|
if (!visible) {
|
||||||
|
NotificationS.historyHovered = false
|
||||||
|
_allowAutoClose = false
|
||||||
|
}
|
||||||
|
}
|
||||||
|
Component.onDestruction: NotificationS.historyHovered = false
|
||||||
|
|
||||||
FocusScope {
|
FocusScope {
|
||||||
id: nHistoryScope
|
id: nHistoryScope
|
||||||
|
anchors.fill: parent
|
||||||
focus: true
|
focus: true
|
||||||
|
|
||||||
Keys.onReleased: function(event) {
|
Keys.onReleased: function(event) {
|
||||||
if (event.key === Qt.Key_Escape) {
|
if (event.key === Qt.Key_Escape) {
|
||||||
console.log("Pressed Escape, closing JLearner")
|
console.log("Pressed Escape, closing NotificationHistory")
|
||||||
notifificationHistoryLoader.active = false
|
root.closeNHistory()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
Rectangle {
|
Rectangle {
|
||||||
anchors.fill: parent
|
anchors.fill: parent
|
||||||
color: "lightblue"
|
color: "lightblue"
|
||||||
|
visible: false // debug helper, keep hidden in normal use
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -92,14 +141,22 @@ PanelWindow {
|
|||||||
border.color: textColor
|
border.color: textColor
|
||||||
radius: Config.screen_big_radius_fun(screen.height)
|
radius: Config.screen_big_radius_fun(screen.height)
|
||||||
|
|
||||||
// Text {
|
// HoverHandler on background (parent of all history UI) stays hovered
|
||||||
// anchors.centerIn: parent
|
// when pointer is over any descendant (topBar buttons, NotificationBody etc.)
|
||||||
// font.family: Config.font
|
// because HoverHandler is non-blocking PointerHandler and tracks parent
|
||||||
// font.pixelSize: bigFontSize
|
// bounds rather than exclusive MouseArea containsMouse. This fixes bug
|
||||||
// color: textColor
|
// where hovering over inner buttons made historyHovered false and triggered
|
||||||
// wrapMode: Text.Wrap
|
// auto-close. Using CanTakeOverFromAnything ensures it isn't blocked by
|
||||||
// text: NotificationS.trackedNotifications.values[0]
|
// child MouseAreas.
|
||||||
// }
|
HoverHandler {
|
||||||
|
id: backgroundHoverHandler
|
||||||
|
blocking: false
|
||||||
|
grabPermissions: PointerHandler.CanTakeOverFromAnything
|
||||||
|
onHoveredChanged: {
|
||||||
|
NotificationS.historyHovered = hovered
|
||||||
|
if (Config.debug == "Notification") console.log("[NotificationHistory] background hovered:", hovered)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
// Component.onCompleted: {
|
// Component.onCompleted: {
|
||||||
// for (var notification in NotificationS.trackedNotifications.values) {
|
// for (var notification in NotificationS.trackedNotifications.values) {
|
||||||
@@ -154,7 +211,7 @@ PanelWindow {
|
|||||||
spacing: Config.screen_spacing_fun(screen.height)
|
spacing: Config.screen_spacing_fun(screen.height)
|
||||||
|
|
||||||
Text{
|
Text{
|
||||||
text: NotificationS.soundEnabled ? "" : ""
|
text: NotificationS.notificationPopupEnabled ? "" : ""
|
||||||
font.family: Config.font
|
font.family: Config.font
|
||||||
font.pixelSize: topBar.height*0.75
|
font.pixelSize: topBar.height*0.75
|
||||||
color: textColor
|
color: textColor
|
||||||
@@ -166,7 +223,7 @@ PanelWindow {
|
|||||||
implicitWidth: notificationVolumeSwitch.height*2
|
implicitWidth: notificationVolumeSwitch.height*2
|
||||||
implicitHeight: topBar.height*0.75
|
implicitHeight: topBar.height*0.75
|
||||||
anchors.verticalCenter: parent.verticalCenter
|
anchors.verticalCenter: parent.verticalCenter
|
||||||
checked: NotificationS.soundEnabled
|
checked: NotificationS.notificationPopupEnabled
|
||||||
|
|
||||||
indicator: Rectangle {
|
indicator: Rectangle {
|
||||||
implicitWidth: notificationVolumeSwitch.width
|
implicitWidth: notificationVolumeSwitch.width
|
||||||
@@ -203,8 +260,8 @@ PanelWindow {
|
|||||||
}
|
}
|
||||||
|
|
||||||
onCheckedChanged: {
|
onCheckedChanged: {
|
||||||
NotificationS.soundEnabled = notificationVolumeSwitch.checked
|
NotificationS.notificationPopupEnabled = notificationVolumeSwitch.checked
|
||||||
console.log("NotificationS.soundEnabled:", NotificationS.soundEnabled)
|
console.log("NotificationS.notificationPopupEnabled:", NotificationS.notificationPopupEnabled)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -215,6 +272,9 @@ PanelWindow {
|
|||||||
anchors.verticalCenter: parent.verticalCenter
|
anchors.verticalCenter: parent.verticalCenter
|
||||||
hoverEnabled: true
|
hoverEnabled: true
|
||||||
cursorShape: Qt.PointingHandCursor
|
cursorShape: Qt.PointingHandCursor
|
||||||
|
// Safety: hovering over button should keep history considered hovered
|
||||||
|
// even if background HoverHandler is blocked (exclusive hover)
|
||||||
|
onContainsMouseChanged: if (containsMouse) NotificationS.historyHovered = true
|
||||||
Rectangle{
|
Rectangle{
|
||||||
anchors.fill: parent
|
anchors.fill: parent
|
||||||
color: closeArea.containsMouse ? "red" : textBGColor
|
color: closeArea.containsMouse ? "red" : textBGColor
|
||||||
@@ -292,6 +352,14 @@ PanelWindow {
|
|||||||
implicitHeight: isGrouped ? groupedCard.implicitHeight : singleBody.implicitHeight
|
implicitHeight: isGrouped ? groupedCard.implicitHeight : singleBody.implicitHeight
|
||||||
height: implicitHeight
|
height: implicitHeight
|
||||||
|
|
||||||
|
// Keep history hovered when pointer is over this delegate
|
||||||
|
// (covers NotificationBody and its inner buttons).
|
||||||
|
HoverHandler {
|
||||||
|
blocking: false
|
||||||
|
grabPermissions: PointerHandler.CanTakeOverFromAnything
|
||||||
|
onHoveredChanged: if (hovered) NotificationS.historyHovered = true
|
||||||
|
}
|
||||||
|
|
||||||
// ── Singleton: plain NotificationBody ──
|
// ── Singleton: plain NotificationBody ──
|
||||||
NotificationBody {
|
NotificationBody {
|
||||||
id: singleBody
|
id: singleBody
|
||||||
@@ -336,6 +404,8 @@ PanelWindow {
|
|||||||
MouseArea {
|
MouseArea {
|
||||||
anchors.fill: parent
|
anchors.fill: parent
|
||||||
cursorShape: Qt.PointingHandCursor
|
cursorShape: Qt.PointingHandCursor
|
||||||
|
hoverEnabled: true
|
||||||
|
onContainsMouseChanged: if (containsMouse) NotificationS.historyHovered = true
|
||||||
onClicked: root.toggleGroup(group.appName)
|
onClicked: root.toggleGroup(group.appName)
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -387,6 +457,7 @@ PanelWindow {
|
|||||||
height: bigFontSize + Config.spacing
|
height: bigFontSize + Config.spacing
|
||||||
hoverEnabled: true
|
hoverEnabled: true
|
||||||
cursorShape: Qt.PointingHandCursor
|
cursorShape: Qt.PointingHandCursor
|
||||||
|
onContainsMouseChanged: if (containsMouse) NotificationS.historyHovered = true
|
||||||
onClicked: function(mouse) {
|
onClicked: function(mouse) {
|
||||||
mouse.accepted = true
|
mouse.accepted = true
|
||||||
root.clearGroup(group.appName)
|
root.clearGroup(group.appName)
|
||||||
|
|||||||
@@ -15,10 +15,20 @@ Item { // container, invisible
|
|||||||
active: false
|
active: false
|
||||||
NotificationHistory {
|
NotificationHistory {
|
||||||
id: nHistory
|
id: nHistory
|
||||||
|
// closeNHistory() is defined inside NotificationHistory.qml and
|
||||||
|
// emits NotificationS.closeHistoryRequested(); the loader listens below
|
||||||
|
// and actually deactivates. Keeping instance id for potential direct access.
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
function closeNHistory() {
|
// React to close requests coming from NotificationHistory (hover timer, Escape)
|
||||||
nHistoryLoader.closeNHistory()
|
// or any other component via the singleton signal. This is the single
|
||||||
}
|
// source of truth for deactivating the history panel.
|
||||||
|
Connections {
|
||||||
|
target: NotificationS
|
||||||
|
function onCloseHistoryRequested() {
|
||||||
|
console.log("[NotificationHistoryLoader] closeHistoryRequested received -> closing")
|
||||||
|
nHistoryLoader.closeNHistory()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -37,11 +47,19 @@ Item { // container, invisible
|
|||||||
}
|
}
|
||||||
|
|
||||||
function closeNHistory() {
|
function closeNHistory() {
|
||||||
|
// Reset hover states so timer doesn't immediately re-trigger on next open
|
||||||
|
NotificationS.historyHovered = false
|
||||||
|
// buttonHovered is managed by the button itself; don't force false here
|
||||||
|
// in case button is still hovered when history closes
|
||||||
notifificationHistoryLoader.active = false
|
notifificationHistoryLoader.active = false
|
||||||
}
|
}
|
||||||
|
|
||||||
function toggleNHistory() {
|
function toggleNHistory() {
|
||||||
notifificationHistoryLoader.active = !notifificationHistoryLoader.active
|
if (notifificationHistoryLoader.active) {
|
||||||
|
closeNHistory()
|
||||||
|
} else {
|
||||||
|
openNHistory()
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
Component.onCompleted: {
|
Component.onCompleted: {
|
||||||
|
|||||||
@@ -12,13 +12,24 @@ Item {
|
|||||||
|
|
||||||
property var focusedMonitor: null
|
property var focusedMonitor: null
|
||||||
property var newestNotification: null
|
property var newestNotification: null
|
||||||
property bool soundEnabled: true
|
property bool notificationPopupEnabled: true
|
||||||
|
|
||||||
property alias trackedNotifications: notificationServer.trackedNotifications
|
property alias trackedNotifications: notificationServer.trackedNotifications
|
||||||
property int notificationNum: trackedNotifications.values.length
|
property int notificationNum: trackedNotifications.values.length
|
||||||
|
|
||||||
signal notificationReceived(var notification)
|
signal notificationReceived(var notification)
|
||||||
|
|
||||||
|
// ── Hover state for history auto-close ──
|
||||||
|
// Updated by NotificationHistory.qml (PanelWindow hover) and NotificationButton.qml (bar button hover)
|
||||||
|
property bool historyHovered: false
|
||||||
|
property bool buttonHovered: false
|
||||||
|
property int historyAutoCloseDelay: 1000
|
||||||
|
signal closeHistoryRequested()
|
||||||
|
|
||||||
|
// Debug logging for hover transitions
|
||||||
|
onHistoryHoveredChanged: Config.debug == "Notification" && console.log("[NotificationServer] historyHovered:", historyHovered)
|
||||||
|
onButtonHoveredChanged: Config.debug == "Notification" && console.log("[NotificationServer] buttonHovered:", buttonHovered)
|
||||||
|
|
||||||
function correctMonitor(screen) {
|
function correctMonitor(screen) {
|
||||||
return (Hyprland.monitorFor(screen) === focusedMonitor)
|
return (Hyprland.monitorFor(screen) === focusedMonitor)
|
||||||
}
|
}
|
||||||
@@ -83,7 +94,7 @@ Item {
|
|||||||
repeat: false
|
repeat: false
|
||||||
|
|
||||||
onTriggered: {
|
onTriggered: {
|
||||||
if((!notification.lastGeneration && notificationServerState.soundEnabled) || Config.debug == "Notification"){
|
if((!notification.lastGeneration && notificationServerState.notificationPopupEnabled) || Config.debug == "Notification"){
|
||||||
focusedMonitor = Hyprland.focusedMonitor
|
focusedMonitor = Hyprland.focusedMonitor
|
||||||
notificationReceived(notification)
|
notificationReceived(notification)
|
||||||
notificationSound.play()
|
notificationSound.play()
|
||||||
|
|||||||
Reference in New Issue
Block a user