forked from Shinonome/dots-hyprland
fix notif popup not showing
This commit is contained in:
@@ -12,101 +12,96 @@ import Quickshell.Hyprland
|
|||||||
Scope {
|
Scope {
|
||||||
id: notificationPopup
|
id: notificationPopup
|
||||||
|
|
||||||
LazyLoader {
|
PanelWindow {
|
||||||
loading: true
|
id: root
|
||||||
PanelWindow {
|
visible: (Notifications.popupList.length > 0)
|
||||||
id: root
|
screen: Quickshell.screens.find(s => s.name === Hyprland.focusedMonitor?.name)
|
||||||
visible: (Notifications.popupList.length > 0)
|
|
||||||
screen: Quickshell.screens.find(s => s.name === Hyprland.focusedMonitor?.name)
|
|
||||||
|
|
||||||
WlrLayershell.namespace: "quickshell:notificationPopup"
|
WlrLayershell.namespace: "quickshell:notificationPopup"
|
||||||
WlrLayershell.layer: WlrLayer.Overlay
|
WlrLayershell.layer: WlrLayer.Overlay
|
||||||
exclusiveZone: 0
|
exclusiveZone: 0
|
||||||
|
|
||||||
anchors {
|
anchors {
|
||||||
top: true
|
top: true
|
||||||
right: true
|
right: true
|
||||||
bottom: true
|
bottom: true
|
||||||
|
}
|
||||||
|
|
||||||
|
mask: Region {
|
||||||
|
item: listview.contentItem
|
||||||
|
}
|
||||||
|
|
||||||
|
color: "transparent"
|
||||||
|
implicitWidth: Appearance.sizes.notificationPopupWidth
|
||||||
|
|
||||||
|
ListView { // Scrollable window
|
||||||
|
id: listview
|
||||||
|
anchors.top: parent.top
|
||||||
|
anchors.bottom: parent.bottom
|
||||||
|
anchors.horizontalCenter: parent.horizontalCenter
|
||||||
|
implicitWidth: parent.width - Appearance.sizes.elevationMargin * 2
|
||||||
|
|
||||||
|
add: Transition {
|
||||||
|
animations: [
|
||||||
|
Appearance.animation.elementMove.numberAnimation.createObject(this, {
|
||||||
|
properties: "opacity,scale",
|
||||||
|
from: 0,
|
||||||
|
to: 1,
|
||||||
|
}),
|
||||||
|
]
|
||||||
}
|
}
|
||||||
|
|
||||||
mask: Region {
|
addDisplaced: Transition {
|
||||||
item: listview.contentItem
|
animations: [
|
||||||
|
Appearance.animation.elementMove.numberAnimation.createObject(this, {
|
||||||
|
property: "y",
|
||||||
|
}),
|
||||||
|
Appearance.animation.elementMove.numberAnimation.createObject(this, {
|
||||||
|
properties: "opacity,scale",
|
||||||
|
to: 1,
|
||||||
|
}),
|
||||||
|
]
|
||||||
}
|
}
|
||||||
|
|
||||||
color: "transparent"
|
displaced: Transition {
|
||||||
implicitWidth: Appearance.sizes.notificationPopupWidth
|
animations: [
|
||||||
|
Appearance.animation.elementMove.numberAnimation.createObject(this, {
|
||||||
ListView { // Scrollable window
|
property: "y",
|
||||||
id: listview
|
}),
|
||||||
anchors.top: parent.top
|
]
|
||||||
anchors.bottom: parent.bottom
|
}
|
||||||
anchors.horizontalCenter: parent.horizontalCenter
|
move: Transition {
|
||||||
implicitWidth: parent.width - Appearance.sizes.elevationMargin * 2
|
animations: [
|
||||||
|
Appearance.animation.elementMove.numberAnimation.createObject(this, {
|
||||||
add: Transition {
|
property: "y",
|
||||||
animations: [
|
}),
|
||||||
Appearance.animation.elementMove.numberAnimation.createObject(this, {
|
]
|
||||||
properties: "opacity,scale",
|
|
||||||
from: 0,
|
|
||||||
to: 1,
|
|
||||||
}),
|
|
||||||
]
|
|
||||||
}
|
|
||||||
|
|
||||||
addDisplaced: Transition {
|
|
||||||
animations: [
|
|
||||||
Appearance.animation.elementMove.numberAnimation.createObject(this, {
|
|
||||||
property: "y",
|
|
||||||
}),
|
|
||||||
Appearance.animation.elementMove.numberAnimation.createObject(this, {
|
|
||||||
properties: "opacity,scale",
|
|
||||||
to: 1,
|
|
||||||
}),
|
|
||||||
]
|
|
||||||
}
|
|
||||||
|
|
||||||
displaced: Transition {
|
|
||||||
animations: [
|
|
||||||
Appearance.animation.elementMove.numberAnimation.createObject(this, {
|
|
||||||
property: "y",
|
|
||||||
}),
|
|
||||||
]
|
|
||||||
}
|
|
||||||
move: Transition {
|
|
||||||
animations: [
|
|
||||||
Appearance.animation.elementMove.numberAnimation.createObject(this, {
|
|
||||||
property: "y",
|
|
||||||
}),
|
|
||||||
]
|
|
||||||
}
|
|
||||||
|
|
||||||
remove: Transition {
|
|
||||||
animations: [
|
|
||||||
Appearance.animation.elementMove.numberAnimation.createObject(this, {
|
|
||||||
property: "x",
|
|
||||||
to: listview.width,
|
|
||||||
}),
|
|
||||||
Appearance.animation.elementMove.numberAnimation.createObject(this, {
|
|
||||||
property: "opacity",
|
|
||||||
to: 0,
|
|
||||||
})
|
|
||||||
]
|
|
||||||
}
|
|
||||||
|
|
||||||
model: ScriptModel {
|
|
||||||
values: Notifications.popupList.slice().reverse()
|
|
||||||
}
|
|
||||||
delegate: NotificationWidget {
|
|
||||||
required property var modelData
|
|
||||||
id: notificationWidget
|
|
||||||
popup: true
|
|
||||||
anchors.left: parent?.left
|
|
||||||
anchors.right: parent?.right
|
|
||||||
notificationObject: modelData
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
remove: Transition {
|
||||||
|
animations: [
|
||||||
|
Appearance.animation.elementMove.numberAnimation.createObject(this, {
|
||||||
|
property: "x",
|
||||||
|
to: listview.width,
|
||||||
|
}),
|
||||||
|
Appearance.animation.elementMove.numberAnimation.createObject(this, {
|
||||||
|
property: "opacity",
|
||||||
|
to: 0,
|
||||||
|
})
|
||||||
|
]
|
||||||
|
}
|
||||||
|
|
||||||
|
model: ScriptModel {
|
||||||
|
values: Notifications.popupList.slice().reverse()
|
||||||
|
}
|
||||||
|
delegate: NotificationWidget {
|
||||||
|
required property var modelData
|
||||||
|
id: notificationWidget
|
||||||
|
popup: true
|
||||||
|
anchors.left: parent?.left
|
||||||
|
anchors.right: parent?.right
|
||||||
|
notificationObject: modelData
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -180,7 +180,6 @@ Scope { // Scope
|
|||||||
|
|
||||||
function toggle(): void {
|
function toggle(): void {
|
||||||
sidebarLoader.active = !sidebarLoader.active
|
sidebarLoader.active = !sidebarLoader.active
|
||||||
if(sidebarLoader.active) Notifications.timeoutAll();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
function close(): void {
|
function close(): void {
|
||||||
@@ -189,7 +188,6 @@ Scope { // Scope
|
|||||||
|
|
||||||
function open(): void {
|
function open(): void {
|
||||||
sidebarLoader.active = true
|
sidebarLoader.active = true
|
||||||
if(sidebarLoader.active) Notifications.timeoutAll();
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -199,7 +197,6 @@ Scope { // Scope
|
|||||||
|
|
||||||
onPressed: {
|
onPressed: {
|
||||||
sidebarLoader.active = !sidebarLoader.active;
|
sidebarLoader.active = !sidebarLoader.active;
|
||||||
if(sidebarLoader.active) Notifications.timeoutAll();
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -209,7 +206,6 @@ Scope { // Scope
|
|||||||
|
|
||||||
onPressed: {
|
onPressed: {
|
||||||
sidebarLoader.active = true;
|
sidebarLoader.active = true;
|
||||||
if(sidebarLoader.active) Notifications.timeoutAll();
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -2,6 +2,7 @@ pragma Singleton
|
|||||||
pragma ComponentBehavior: Bound
|
pragma ComponentBehavior: Bound
|
||||||
|
|
||||||
import "root:/modules/common"
|
import "root:/modules/common"
|
||||||
|
import "root:/"
|
||||||
import QtQuick
|
import QtQuick
|
||||||
import Quickshell
|
import Quickshell
|
||||||
import Quickshell.Io
|
import Quickshell.Io
|
||||||
@@ -13,6 +14,7 @@ Singleton {
|
|||||||
property var filePath: `${XdgDirectories.cache}/notifications/notifications.json`
|
property var filePath: `${XdgDirectories.cache}/notifications/notifications.json`
|
||||||
property var list: []
|
property var list: []
|
||||||
property var popupList: []
|
property var popupList: []
|
||||||
|
property bool popupInhibited: GlobalStates?.sidebarRightOpen ?? false
|
||||||
// Quickshell's notification IDs starts at 1 on each run, while saved notifications
|
// Quickshell's notification IDs starts at 1 on each run, while saved notifications
|
||||||
// can already contain higher IDs. This is for avoiding id collisions
|
// can already contain higher IDs. This is for avoiding id collisions
|
||||||
property int idOffset
|
property int idOffset
|
||||||
@@ -54,7 +56,8 @@ Singleton {
|
|||||||
"urgency": notification.urgency.toString(),
|
"urgency": notification.urgency.toString(),
|
||||||
}
|
}
|
||||||
root.list = [...root.list, newNotifObject];
|
root.list = [...root.list, newNotifObject];
|
||||||
root.popupList = [...root.popupList, newNotifObject];
|
// console.log(root.popupInhibited)
|
||||||
|
if (!root.popupInhibited) root.popupList = [...root.popupList, newNotifObject];
|
||||||
root.notify(newNotifObject);
|
root.notify(newNotifObject);
|
||||||
notifFileView.setText(JSON.stringify(root.list, null, 2))
|
notifFileView.setText(JSON.stringify(root.list, null, 2))
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user