From 1b51d1a9b3be0edb1cb5dd44d9c268d4bd034e42 Mon Sep 17 00:00:00 2001 From: lucy Date: Tue, 23 Dec 2025 20:21:18 +0100 Subject: [PATCH] working notifications and fuck i gotta commit more often bwaaa --- modules/bar/Colors.qml | 38 ++++---- modules/bar/TrayItem.qml | 2 - modules/notifications/NotiPopup.qml | 129 ++++++++++++++++++++++++++ modules/notifications/NotifServer.qml | 15 +++ modules/notifications/qmldir | 2 + modules/wallpaper/WallSwitcher.qml | 2 +- shell.qml | 11 ++- 7 files changed, 173 insertions(+), 26 deletions(-) create mode 100644 modules/notifications/NotiPopup.qml create mode 100644 modules/notifications/NotifServer.qml create mode 100644 modules/notifications/qmldir diff --git a/modules/bar/Colors.qml b/modules/bar/Colors.qml index d195656..0e0a638 100644 --- a/modules/bar/Colors.qml +++ b/modules/bar/Colors.qml @@ -5,25 +5,25 @@ import Quickshell Singleton { id: customColors // Core Backgrounds - readonly property color background: "#0E0D15" - readonly property color foreground: "#EFEEFB" - readonly property color cursor: "#AE9CB4" + readonly property color background: "#1A1B26" + readonly property color foreground: "#C0CAF5" + readonly property color cursor: "#C0CAF5" // The 16 Colors of the Apocalypse - readonly property color color0: "#383841" - readonly property color color1: "#27659D" - readonly property color color2: "#8E348E" - readonly property color color3: "#4638D8" - readonly property color color4: "#3BA63E" - readonly property color color5: "#DB405A" - readonly property color color6: "#6C5CF4" - readonly property color color7: "#E0DEF1" - readonly property color color8: "#9C9BA9" - readonly property color color9: "#27659D" - readonly property color color10: "#8E348E" - readonly property color color11: "#4638D8" - readonly property color color12: "#3BA63E" - readonly property color color13: "#DB405A" - readonly property color color14: "#6C5CF4" - readonly property color color15: "#E0DEF1" + readonly property color color0: "#414868" + readonly property color color1: "#F7768E" + readonly property color color2: "#9ECE6A" + readonly property color color3: "#E0AF68" + readonly property color color4: "#7AA2F7" + readonly property color color5: "#BB9AF7" + readonly property color color6: "#7DCFFF" + readonly property color color7: "#A9B1D6" + readonly property color color8: "#414868" + readonly property color color9: "#F7768E" + readonly property color color10: "#9ECE6A" + readonly property color color11: "#E0AF68" + readonly property color color12: "#7AA2F7" + readonly property color color13: "#BB9AF7" + readonly property color color14: "#7DCFFF" + readonly property color color15: "#C0CAF5" } diff --git a/modules/bar/TrayItem.qml b/modules/bar/TrayItem.qml index 5096b70..029a6c0 100644 --- a/modules/bar/TrayItem.qml +++ b/modules/bar/TrayItem.qml @@ -1,5 +1,3 @@ -pragma ComponentBehavior: Bound - import QtQuick import Quickshell import Quickshell.Services.SystemTray diff --git a/modules/notifications/NotiPopup.qml b/modules/notifications/NotiPopup.qml new file mode 100644 index 0000000..f487aee --- /dev/null +++ b/modules/notifications/NotiPopup.qml @@ -0,0 +1,129 @@ +import QtQuick +import Quickshell +import Quickshell.Wayland +import qs.modules.bar +import "." +import QtQuick.Layouts + +WlrLayershell { + id: root + + // 1. Position: Top Right Corner, covering the full height + // We make it a fixed width (e.g., 400px) so it doesn't block the whole screen + anchors { + top: true + right: true + } + margins { + top: 30 + } + + width: 400 + height: notifList.contentHeight + 10 + + // 2. Layer: Put it ABOVE normal windows + layer: WlrLayer.Overlay + exclusionMode: ExclusionMode.Ignore + + // 3. CRITICAL: Make the window itself invisible! + // We only want to see the notifications, not the container. + color: "transparent" + + // 4. Input: Let clicks pass through empty areas + // (This is default behavior if the background is transparent in some compositors, + // but usually you need to be careful with handling mouse events here) + + // THE SPAWNER + ListView { + id: notifList + anchors.fill: parent + anchors.margins: 10 + // Use 'spacing' to put gaps between notifications + spacing: 10 + + // Align to the bottom (like Windows) or Top (like GNOME)? + // verticalLayoutDirection: ListView.BottomToTop + + // 🔗 CONNECT TO THE SERVER + // Assuming your NotificationServer is a singleton or globally accessible + // ... other imports + + // Inside your ListView... + delegate: Item { + width: ListView.view.width + height: 60 // Fixed height is usually better for icon layouts + + required property var modelData + + Rectangle { + anchors.fill: parent + color: Colors.background + radius: 10 + border.color: Colors.color5 + + // 2. Use RowLayout to put Image | Text side-by-side + RowLayout { + anchors.fill: parent + anchors.margins: 10 + spacing: 15 + + // 🖼️ THE IMAGE ON THE LEFT + Image { + // Use the image if available, otherwise hide this space? + // Or you could use an icon fallback. + source: modelData.image + + // Hide if no image exists so text takes full width + visible: modelData.image !== "" + + // Fixed size for consistency + Layout.preferredWidth: 48 + Layout.preferredHeight: 48 + + // Crop it nicely so it doesn't stretch + fillMode: Image.PreserveAspectCrop + + // Optional: Cache it for performance + asynchronous: true + } + + // 📝 THE TEXT ON THE RIGHT + ColumnLayout { + // Take up all remaining width + Layout.fillWidth: true + Layout.alignment: Qt.AlignVCenter // Center vertically + spacing: 2 + + Text { + text: modelData.summary + color: Colors.foreground + font.bold: true + elide: Text.ElideRight + Layout.fillWidth: true + } + + Text { + text: modelData.body + color: Colors.foreground + + // Limit to 2 lines + maximumLineCount: 2 + wrapMode: Text.WordWrap + elide: Text.ElideRight + + Layout.fillWidth: true + } + } + } + + // (Your MouseArea for closing can still go here covering the whole thing) + MouseArea { + anchors.fill: parent + acceptedButtons: Qt.LeftButton + onClicked: modelData.dismiss() + } + } + } + model: NotifServer.trackedNotifications + } +} diff --git a/modules/notifications/NotifServer.qml b/modules/notifications/NotifServer.qml new file mode 100644 index 0000000..dd3a6c8 --- /dev/null +++ b/modules/notifications/NotifServer.qml @@ -0,0 +1,15 @@ +pragma ComponentBehavior: Bound +pragma Singleton +import Quickshell.Services.Notifications +import QtQuick +import Quickshell + +NotificationServer { + bodyMarkupSupported: true + persistenceSupported: true + imageSupported: true + onNotification: notification => { + notification.tracked = true; + console.log("got notification!!! arf woof"); + } +} diff --git a/modules/notifications/qmldir b/modules/notifications/qmldir new file mode 100644 index 0000000..c156412 --- /dev/null +++ b/modules/notifications/qmldir @@ -0,0 +1,2 @@ +singleton NotifServer 1.0 NotifServer.qml +NotiPopup 1.0 NotiPopup.qml diff --git a/modules/wallpaper/WallSwitcher.qml b/modules/wallpaper/WallSwitcher.qml index 0b414c0..78edfc6 100644 --- a/modules/wallpaper/WallSwitcher.qml +++ b/modules/wallpaper/WallSwitcher.qml @@ -92,7 +92,7 @@ FloatingWindow { let cleanPath = fileUrl.toString().replace("file://", ""); // Update the Singleton! WallpaperStore.currentWall = fileUrl.toString(); - generateScheme.startDetached(); + //generateScheme.startDetached(); console.log(generateScheme.stdout); } } diff --git a/shell.qml b/shell.qml index 3e3bf79..f9cde87 100644 --- a/shell.qml +++ b/shell.qml @@ -1,7 +1,9 @@ //@ pragma UseQApplication -import "./modules/bar/" +//pragma ComponentBehavior: Bound import Quickshell -import "./modules/wallpaper/" +import qs.modules.bar +import qs.modules.wallpaper +import qs.modules.notifications Scope { WallSwitcher {} @@ -9,14 +11,15 @@ Scope { id: wallVariants model: Quickshell.screens delegate: Wallpaper { - screen: modelData + screen: wallVariants.modelData } } Variants { id: barVariants model: Quickshell.screens delegate: Bar { - screen: modelData + screen: barVariants.modelData } } + NotiPopup {} }