68 lines
2.1 KiB
QML
68 lines
2.1 KiB
QML
import QtQuick
|
|
import Quickshell
|
|
import Quickshell.Hyprland
|
|
import Quickshell.Io
|
|
import "../../config"
|
|
import "./notificationServer"
|
|
|
|
|
|
Item { // container, invisible
|
|
id: nHistoryLoader
|
|
|
|
LazyLoader {
|
|
id: notifificationHistoryLoader
|
|
// active: true
|
|
active: false
|
|
NotificationHistory {
|
|
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.
|
|
}
|
|
}
|
|
|
|
// React to close requests coming from NotificationHistory (hover timer, Escape)
|
|
// 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()
|
|
}
|
|
}
|
|
|
|
GlobalShortcut {
|
|
name: "NotificationHistory"
|
|
description: "Open Notification History"
|
|
|
|
onPressed: {
|
|
console.log("Pressed Meta+Shift+N (Hyprland global shortcut)")
|
|
notifificationHistoryLoader.active = !notifificationHistoryLoader.active
|
|
}
|
|
}
|
|
|
|
function openNHistory() {
|
|
notifificationHistoryLoader.active = true
|
|
}
|
|
|
|
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
|
|
}
|
|
|
|
function toggleNHistory() {
|
|
if (notifificationHistoryLoader.active) {
|
|
closeNHistory()
|
|
} else {
|
|
openNHistory()
|
|
}
|
|
}
|
|
|
|
Component.onCompleted: {
|
|
console.log("[NotificationHistoryLoader]:", NotificationS)
|
|
}
|
|
} |