50 lines
1.4 KiB
QML
50 lines
1.4 KiB
QML
pragma Singleton
|
|
|
|
import QtQuick
|
|
import Quickshell
|
|
import Quickshell.Hyprland
|
|
import Quickshell.Services.Notifications
|
|
|
|
Item {
|
|
id: notificationServerState
|
|
|
|
property var focusedMonitor: null
|
|
property var newestNotification: null
|
|
property var trackedNotifications: [] // TODO
|
|
|
|
signal notificationReceived(var notification)
|
|
|
|
function correctMonitor(screen) {
|
|
return (Hyprland.monitorFor(screen) === focusedMonitor)
|
|
}
|
|
|
|
NotificationServer {
|
|
id: notificationServer
|
|
onNotification: function(notification) {
|
|
if(notification.lastGeneration){
|
|
console.log(
|
|
"[NotificationServer] Closing Notification:",
|
|
notification.appName, notification.id, notification.summary, notification.body
|
|
)
|
|
notification.dismiss()
|
|
return
|
|
}
|
|
notification.tracked = true
|
|
console.log(
|
|
"[NotificationServer] Notification received:",
|
|
notification.appName, notification.id, notification.summary, notification.body
|
|
)
|
|
notificationReceived(notification)
|
|
Hyprland.refreshMonitors()
|
|
waitTimer.start()
|
|
}
|
|
}
|
|
|
|
Timer {
|
|
id: waitTimer
|
|
interval: 2000
|
|
repeat: false
|
|
onTriggered: focusedMonitor = Hyprland.focusedMonitor
|
|
}
|
|
|
|
} |