quickshell: fix notification toast as separate Variants popup
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
parent
18ccb266c3
commit
5ba4e7d6cf
1 changed files with 151 additions and 132 deletions
|
|
@ -458,6 +458,10 @@ in
|
||||||
import Qt5Compat.GraphicalEffects
|
import Qt5Compat.GraphicalEffects
|
||||||
|
|
||||||
ShellRoot {
|
ShellRoot {
|
||||||
|
id: root
|
||||||
|
property var latestNotification: null
|
||||||
|
signal notificationReceived()
|
||||||
|
|
||||||
NotificationServer {
|
NotificationServer {
|
||||||
id: notifServer
|
id: notifServer
|
||||||
bodySupported: true
|
bodySupported: true
|
||||||
|
|
@ -467,7 +471,8 @@ in
|
||||||
keepOnReload: true
|
keepOnReload: true
|
||||||
onNotification: (notification) => {
|
onNotification: (notification) => {
|
||||||
notification.tracked = true;
|
notification.tracked = true;
|
||||||
notifToast.show(notification);
|
root.latestNotification = notification;
|
||||||
|
root.notificationReceived();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -1660,12 +1665,29 @@ in
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
// Notification toast popup
|
// Notification toast popup
|
||||||
|
Variants {
|
||||||
|
model: Quickshell.screens
|
||||||
|
|
||||||
PopupWindow {
|
PopupWindow {
|
||||||
id: notifToast
|
id: notifToast
|
||||||
|
required property var modelData
|
||||||
|
screen: modelData
|
||||||
property var currentNotif: null
|
property var currentNotif: null
|
||||||
property bool open: false
|
property bool open: false
|
||||||
|
|
||||||
|
Connections {
|
||||||
|
target: root
|
||||||
|
function onNotificationReceived() {
|
||||||
|
if (notifToast.modelData === Quickshell.screens[0]) {
|
||||||
|
notifToast.show(root.latestNotification);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
function show(notification) {
|
function show(notification) {
|
||||||
currentNotif = notification;
|
currentNotif = notification;
|
||||||
visible = true;
|
visible = true;
|
||||||
|
|
@ -1678,14 +1700,12 @@ in
|
||||||
_toastCloseDelay.start();
|
_toastCloseDelay.start();
|
||||||
}
|
}
|
||||||
|
|
||||||
anchor.window: bar
|
anchor.rect.x: (screen ? screen.width / 2 : 0) - 160
|
||||||
anchor.rect.x: bar.width / 2 - 160
|
anchor.rect.y: 30
|
||||||
anchor.rect.y: bar.height
|
|
||||||
anchor.edges: Edges.Top | Edges.Left
|
anchor.edges: Edges.Top | Edges.Left
|
||||||
anchor.gravity: Edges.Bottom | Edges.Right
|
|
||||||
visible: false
|
visible: false
|
||||||
width: 320
|
implicitWidth: 320
|
||||||
height: toastContent.height + 2
|
implicitHeight: toastContent.height + 2
|
||||||
color: "transparent"
|
color: "transparent"
|
||||||
|
|
||||||
Timer {
|
Timer {
|
||||||
|
|
@ -1815,7 +1835,6 @@ in
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
'';
|
'';
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue