quickshell: fix toast and notifServer binding issues

Use PanelWindow with overlay layer instead of PopupWindow for toast.
Rename notifServer id to avoid binding loop with Bar property.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
rope 2026-05-26 20:45:08 +01:00
parent 46585667db
commit 031c8d2166

View file

@ -516,7 +516,7 @@ in
signal notificationReceived() signal notificationReceived()
NotificationServer { NotificationServer {
id: notifServer id: _notifServer
bodySupported: true bodySupported: true
actionsSupported: true actionsSupported: true
imageSupported: true imageSupported: true
@ -533,16 +533,12 @@ in
model: Quickshell.screens model: Quickshell.screens
Bar { Bar {
notifServer: notifServer notifServer: _notifServer
} }
} }
Variants { NotificationToast {
model: Quickshell.screens shellRoot: root
NotificationToast {
shellRoot: root
}
} }
} }
''; '';
@ -1725,22 +1721,24 @@ in
onChange = qsRestart; onChange = qsRestart;
text = '' text = ''
import Quickshell import Quickshell
import Quickshell.Wayland
import QtQuick import QtQuick
PopupWindow { PanelWindow {
id: notifToast id: notifToast
required property var modelData
required property var shellRoot required property var shellRoot
screen: modelData screen: Quickshell.screens[0]
property var currentNotif: null property var currentNotif: null
property bool open: false property bool open: false
WlrLayershell.layer: WlrLayer.Overlay
WlrLayershell.namespace: "quickshell-toast"
exclusionMode: ExclusionMode.Ignore
Connections { Connections {
target: shellRoot target: shellRoot
function onNotificationReceived() { function onNotificationReceived() {
if (notifToast.modelData === Quickshell.screens[0]) { notifToast.show(shellRoot.latestNotification);
notifToast.show(shellRoot.latestNotification);
}
} }
} }
@ -1756,9 +1754,8 @@ in
_toastCloseDelay.start(); _toastCloseDelay.start();
} }
anchor.rect.x: (screen ? screen.width / 2 : 0) - 160 anchors.top: true
anchor.rect.y: 30 margins.top: 30
anchor.edges: Edges.Top | Edges.Left
visible: false visible: false
implicitWidth: 320 implicitWidth: 320
implicitHeight: toastContent.height + 2 implicitHeight: toastContent.height + 2