aboutsummaryrefslogtreecommitdiffstats
path: root/home/quickshell/bar/NotificationPanel.qml
diff options
context:
space:
mode:
authorPetri Hienonen <petri.hienonen@gmail.com>2024-05-23 13:56:00 +0300
committerPetri Hienonen <petri.hienonen@gmail.com>2025-11-30 12:29:57 +0200
commit08297376a85a1719518507e54fca9de954d2376a (patch)
tree3b9c58304b40248533bbb2bb5b7bad2da9da1ff0 /home/quickshell/bar/NotificationPanel.qml
parent75c2af4aedd2ac5c2cfc74b346625fa4b265541d (diff)
downloadnixos-08297376a85a1719518507e54fca9de954d2376a.tar.zst
Agenix configuration
Diffstat (limited to 'home/quickshell/bar/NotificationPanel.qml')
-rw-r--r--home/quickshell/bar/NotificationPanel.qml101
1 files changed, 101 insertions, 0 deletions
diff --git a/home/quickshell/bar/NotificationPanel.qml b/home/quickshell/bar/NotificationPanel.qml
new file mode 100644
index 0000000..0ef8712
--- /dev/null
+++ b/home/quickshell/bar/NotificationPanel.qml
@@ -0,0 +1,101 @@
+import QtQuick
+import QtQuick.Layouts
+import QtQuick.Controls
+import Quickshell
+import Quickshell.Wayland
+import Quickshell.Services.Notifications
+
+PanelWindow {
+ // required property font custom_font
+ required property color text_color
+ property list<QtObject> notification_objects
+
+ width: 500
+ height: 600
+
+ color: "#171a18"
+
+ WlrLayershell.layer: WlrLayer.Overlay
+
+ Rectangle {
+ border.width: 5
+ border.color: "#8ec07c"
+ anchors.fill: parent
+ color: "transparent"
+
+ ColumnLayout {
+ id: content
+ anchors {
+ left: parent.left
+ leftMargin: 10
+ right: parent.right
+ rightMargin: 10
+ top: parent.top
+ topMargin: 10
+ }
+
+ RowLayout {
+ Layout.fillWidth: true
+
+ Text {
+ Layout.fillWidth: true
+ text: "Notifications:"
+ // font: custom_font
+ color: text_color
+ }
+
+ Text {
+ text: "clear"
+ // font: custom_font
+ color: text_color
+
+ TapHandler {
+ id: tapHandler
+ gesturePolicy: TapHandler.ReleaseWithinBounds
+ onTapped: {
+ server.trackedNotifications.values.forEach((notification) => {
+ notification.tracked = false
+ })
+ notification_objects.forEach((object) => {
+ object.destroy();
+ })
+ notification_objects = [];
+ }
+ }
+
+ HoverHandler {
+ id: mouse
+ acceptedDevices: PointerDevice.Mouse | PointerDevice.TouchPad
+ cursorShape: Qt.PointingHandCursor
+ }
+ }
+ }
+ }
+ }
+
+ NotificationServer {
+ id: server
+ onNotification: (notification) => {
+ notification.tracked = true
+ console.log(JSON.stringify(notification));
+ var notification_component = Qt.createComponent("Notification.qml");
+ var notification_object = notification_component
+ .createObject(content,
+ {
+ id: notification.id,
+ body: notification.body,
+ summary: notification.summary,
+ // font: custom_font,
+ color: text_color,
+ margin: 10
+ }
+ )
+ if (notification_object == null) {
+ console.log("Error creating notification")
+ } else {
+ notification_objects.push(notification_object);
+ }
+ }
+ }
+}
+