quickshell: fix notification toast as separate Variants popup

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
rope 2026-05-26 20:06:48 +01:00
parent 18ccb266c3
commit 5ba4e7d6cf

View file

@ -458,6 +458,10 @@ in
import Qt5Compat.GraphicalEffects
ShellRoot {
id: root
property var latestNotification: null
signal notificationReceived()
NotificationServer {
id: notifServer
bodySupported: true
@ -467,7 +471,8 @@ in
keepOnReload: true
onNotification: (notification) => {
notification.tracked = true;
notifToast.show(notification);
root.latestNotification = notification;
root.notificationReceived();
}
}
@ -1660,12 +1665,29 @@ in
}
}
}
}
}
// Notification toast popup
Variants {
model: Quickshell.screens
PopupWindow {
id: notifToast
required property var modelData
screen: modelData
property var currentNotif: null
property bool open: false
Connections {
target: root
function onNotificationReceived() {
if (notifToast.modelData === Quickshell.screens[0]) {
notifToast.show(root.latestNotification);
}
}
}
function show(notification) {
currentNotif = notification;
visible = true;
@ -1678,14 +1700,12 @@ in
_toastCloseDelay.start();
}
anchor.window: bar
anchor.rect.x: bar.width / 2 - 160
anchor.rect.y: bar.height
anchor.rect.x: (screen ? screen.width / 2 : 0) - 160
anchor.rect.y: 30
anchor.edges: Edges.Top | Edges.Left
anchor.gravity: Edges.Bottom | Edges.Right
visible: false
width: 320
height: toastContent.height + 2
implicitWidth: 320
implicitHeight: toastContent.height + 2
color: "transparent"
Timer {
@ -1815,7 +1835,6 @@ in
}
}
}
}
'';
};