repositories / dotfiles

dotfiles

bugabingas dorkfiles

owned by bugabinga

feat(quickshell): add native notification daemon

6a6ebc5c32eead6dbacc7621399af3af6e26ce91

Oliver Jan Krylow <oliver@bugabinga.net> ·

unsigned

Browse filesCompare with HEAD

Changed files (6)

docs/super/inventory/2026-06-17-quickshell-phase-3-notification-verification.md

Added
new file mode 100644
1 +# Quickshell Phase 3 Notification Verification — 2026-06-17
3 +## Scope
5 +Phase 3 native notification daemon implementation was added, disabled by default. This phase is **not accepted** yet because live DBus ownership could not be verified from the agent shell.
7 +## Implemented files
9 +- `quickshell/nugu/NotificationDaemon.qml`
10 +- `quickshell/nugu/NotificationToast.qml`
11 +- `quickshell/nugu/shell.qml` IPC loader wiring
12 +- `docs/super/plans/2026-06-17-quickshell-hypr-companions-phase-3-notification-daemon.md`
14 +## Commands
16 +- `dbus-run-session -- timeout 3s qs -p quickshell/nugu/shell.qml`
17 +- temporary named config with `qs -c nugu`
18 +- `qs ipc -c nugu call nugu enableNativeNotifications`
19 +- `notify-send 'Nugu normal' 'normal notification body'`
20 +- `qs ipc -c nugu call nugu nativeNotificationCount`
21 +- guarded real-session attempt with `systemctl --user stop mako.service` and cleanup trap to restart Mako
23 +## Parse validation
25 +Result: PASS.
27 +```text
28 +exit=124
29 +INFO: Configuration Loaded
30 +```
32 +The daemon is behind a disabled `Loader`, so normal Quickshell startup does not claim `org.freedesktop.Notifications` and does not fight Mako.
34 +## Isolated DBus test
36 +Result: BLOCKED.
38 +Inside `dbus-run-session`, enabling the native daemon returned `enabled`, but Quickshell could not register the notification service:
40 +```text
41 +quickshell.service.notifications: Could not register notification server at org.freedesktop.Notifications, presumably because one is already registered.
42 +Registration will be attempted again if the active service is unregistered.
43 +count1=0
44 +count3=0
45 +```
47 +## Real-session guarded test
49 +Result: BLOCKED.
51 +A guarded script stopped Mako, started temporary Quickshell, enabled native notifications, and sent `notify-send`. Cleanup restarted Mako.
53 +Quickshell failed to connect to the user DBus from this agent shell:
55 +```text
56 +quickshell.service.notifications: Could not connect to DBus. Notification service will not work.
57 +Failed to show notification: Error receiving data: Connection reset by peer
58 +```
60 +Subsequent agent-shell DBus probes also failed:
62 +```text
63 +busctl --user --list: Connection reset by peer
64 +dbus-send --session ... ListNames: org.freedesktop.DBus.Error.Disconnected
65 +notify-send: The connection is closed
66 +```
68 +The systemd user environment still advertises:
70 +```text
71 +DBUS_SESSION_BUS_ADDRESS=unix:path=/run/user/1000/bus
72 +WAYLAND_DISPLAY=wayland-1
73 +XDG_CURRENT_DESKTOP=Hyprland
74 +```
76 +## Rollback / service boundary
78 +Rollback succeeded; Mako and old bar services are active:
80 +```text
81 +mako.service active
82 +ironbar.service active
83 +ironbar-workspaces.service active
84 +```
86 +No `qs` process remains.
88 +## Known gaps before Phase 3 acceptance
90 +- Need a working live user DBus test environment for Quickshell to own `org.freedesktop.Notifications` after stopping Mako.
91 +- Need `notify-send` normal/low/critical screenshots rendered by Quickshell.
92 +- Need timeout verification: low ~2500ms, normal ~6500ms, critical persistent.
93 +- Need action button/default-action tests.
94 +- Need dismiss-all and restore-history IPC verification.
95 +- Only after those pass can Mako retirement be planned.

docs/super/plans/2026-06-17-quickshell-hypr-companions-phase-3-notification-daemon.md

Added
new file mode 100644
1 +# Quickshell Hypr Companions Phase 3 Notification Daemon Implementation Plan
3 +> **For agentic workers:** REQUIRED SUB-SKILL: Use /skill:executing-plans to implement this plan task-by-task. Steps use checkbox (`- [ ]`) syntax for tracking.
5 +**Goal:** Add a native Quickshell notification daemon with Mako-style popup rendering, controlled by IPC and disabled by default until tests stop Mako deliberately.
7 +**Architecture:** Keep Mako live by default. Quickshell only instantiates `NotificationServer` when IPC enables native notifications, avoiding DBus daemon competition during normal Phase 3 development. Popups are rendered as top-right overlay `PanelWindow`s using Nugu tokens and mirror Mako geometry/timeouts closely enough for controlled verification.
9 +**Tech Stack:** Quickshell 0.3.0, QML/QtQuick, `Quickshell.Services.Notifications`, `Quickshell.Wayland`, `notify-send`, Mako rollback via `systemctl --user restart mako.service`.
11 +**Roadmap:** `docs/super/roadmaps/2026-06-17-quickshell-hypr-companions-roadmap.md`
13 +**Phase:** Phase 3: Native notification daemon replacing Mako
15 +---
17 +## Scope Boundary
19 +Implement:
21 +- Native `NotificationServer`, disabled by default.
22 +- Top-right popup stack, max 4 visible, Mako-like size/style.
23 +- Low/normal/critical timeout policy: 2500ms / 6500ms / persistent.
24 +- App, summary, body, optional image/icon placeholder, action buttons.
25 +- Left action invoke, middle/right dismiss.
26 +- History cap 80 and IPC restore/dismiss-all.
27 +- IPC enable/disable/count methods for controlled testing.
28 +- Verification record.
30 +Do not implement:
32 +- Mako retirement.
33 +- Hypr service manifest changes.
34 +- Hypr bind migration.
35 +- Full action test tooling beyond notify-send smoke tests.
36 +- OSDs or launcher.
38 +## Tasks
40 +1. Create `quickshell/nugu/NotificationToast.qml` for one notification popup.
41 +2. Create `quickshell/nugu/NotificationDaemon.qml` with `NotificationServer`, history, restore, dismiss-all, timeout handling.
42 +3. Wire `NotificationDaemon` behind a `Loader` in `shell.qml`; add IPC methods `enableNativeNotifications`, `disableNativeNotifications`, `nativeNotificationCount`, `dismissNativeNotifications`, `restoreNativeNotification`.
43 +4. Parse-check with daemon disabled.
44 +5. Controlled live test: start temporary config, stop Mako, enable native notifications, send `notify-send` normal/low/critical, screenshot, dismiss, disable native notifications, restart Mako.
45 +6. Write `docs/super/inventory/2026-06-17-quickshell-phase-3-notification-verification.md`.
46 +7. Commit without modifying Mako service/manifests.
48 +## Safety Rules
50 +- Before enabling native notifications, stop Mako only inside a test block with a trap that restarts it.
51 +- If Quickshell fails to start or receive notifications, immediately restart Mako.
52 +- Never leave two notification daemons competing except transiently during rollback.
53 +- Never mark Mako obsolete until Phase 3 verification passes and user approves retirement in a later commit.

quickshell/nugu/NotificationDaemon.qml

Added
new file mode 100644
1 +import QtQuick
2 +import Quickshell
3 +import Quickshell.Services.Notifications
4 +import "."
6 +Scope {
7 + id: root
9 + required property QtObject theme
11 + property int count: server.trackedNotifications.values.length
12 + property var history: []
13 + readonly property int historyLimit: 80
15 + // This object is loaded only by explicit IPC after Mako is stopped for a
16 + // controlled test. Creating NotificationServer eagerly would fight Mako on DBus.
17 + NotificationServer {
18 + id: server
19 + keepOnReload: true
20 + persistenceSupported: true
21 + bodySupported: true
22 + bodyMarkupSupported: true
23 + bodyHyperlinksSupported: true
24 + bodyImagesSupported: true
25 + actionsSupported: true
26 + actionIconsSupported: true
27 + imageSupported: true
29 + onNotification: notification => {
30 + notification.tracked = true
31 + root.remember(notification)
32 + root.armExpiry(notification)
33 + }
34 + }
36 + function remember(notification: var): void {
37 + const next = [notification].concat(history.filter(item => item !== notification))
38 + history = next.slice(0, historyLimit)
39 + }
41 + function timeoutFor(notification: var): int {
42 + if (notification.urgency === NotificationUrgency.Critical) return 0
43 + if (notification.urgency === NotificationUrgency.Low) return 2500
44 + if (notification.expireTimeout > 0) return Math.round(notification.expireTimeout * 1000)
45 + return 6500
46 + }
48 + function armExpiry(notification: var): void {
49 + const timeout = timeoutFor(notification)
50 + if (timeout <= 0) return
51 + expiryTimer.createObject(root, { "target": notification, "interval": timeout })
52 + }
54 + function dismiss(notification: var): void {
55 + if (notification) notification.dismiss()
56 + }
58 + function dismissAll(): void {
59 + for (const notification of server.trackedNotifications.values) notification.dismiss()
60 + }
62 + function restoreLast(): void {
63 + const notification = history.find(item => item && !item.tracked)
64 + if (notification) {
65 + notification.tracked = true
66 + armExpiry(notification)
67 + }
68 + }
70 + Component {
71 + id: expiryTimer
72 + Timer {
73 + property var target: null
74 + running: true
75 + repeat: false
76 + onTriggered: if (target && target.tracked) target.expire()
77 + }
78 + }
80 + Repeater {
81 + model: server.trackedNotifications
83 + NotificationToast {
84 + required property var modelData
85 + required property int index
86 + visible: index < 4
87 + theme: root.theme
88 + notification: modelData
89 + stackIndex: index
90 + onDismissRequested: notification => root.dismiss(notification)
91 + }
92 + }

quickshell/nugu/NotificationToast.qml

Added
new file mode 100644
1 +import QtQuick
2 +import QtQuick.Layouts
3 +import Quickshell
4 +import Quickshell.Services.Notifications
5 +import Quickshell.Wayland
7 +PanelWindow {
8 + id: root
10 + required property QtObject theme
11 + required property var notification
12 + required property int stackIndex
14 + signal dismissRequested(var notification)
16 + // Match Mako's top-right overlay geometry while keeping the daemon isolated
17 + // from the bar; notification replacement must be visually comparable first.
18 + anchors { top: true; right: true }
19 + margins { top: 14 + stackIndex * 174; right: 14 }
20 + exclusiveZone: -1
21 + implicitWidth: 360
22 + implicitHeight: 160
23 + color: "transparent"
25 + WlrLayershell {
26 + layer: WlrLayer.Overlay
27 + exclusiveZone: -1
28 + }
30 + function semanticBorder(): string {
31 + const summary = notification ? notification.summary : ""
32 + if (!notification) return theme.ui.accent
33 + if (notification.urgency === NotificationUrgency.Critical || /[Ee]rror|[Ff]ailed|[Ff]ailure|[Cc]rash/.test(summary)) return theme.error
34 + if (/[Ww]arn|[Ww]arning/.test(summary)) return theme.warning
35 + if (/[Ii]nfo|[Nn]otice/.test(summary)) return theme.info
36 + return theme.ui.accent
37 + }
39 + Rectangle {
40 + anchors.fill: parent
41 + radius: 12
42 + color: notification && notification.urgency === NotificationUrgency.Low ? `${root.theme.content.backdrop}e6` : `${root.theme.ui.backdrop}f2`
43 + border.width: notification && notification.urgency === NotificationUrgency.Critical ? 3 : 2
44 + border.color: root.semanticBorder()
45 + clip: true
47 + MouseArea {
48 + anchors.fill: parent
49 + acceptedButtons: Qt.LeftButton | Qt.MiddleButton | Qt.RightButton
50 + onClicked: mouse => {
51 + if (mouse.button === Qt.LeftButton && root.notification && root.notification.actions.length > 0) {
52 + root.notification.actions[0].invoke()
53 + }
54 + root.dismissRequested(root.notification)
55 + }
56 + }
58 + RowLayout {
59 + anchors.fill: parent
60 + anchors.margins: 12
61 + spacing: 10
63 + Rectangle {
64 + Layout.preferredWidth: 48
65 + Layout.preferredHeight: 48
66 + Layout.alignment: Qt.AlignTop
67 + radius: 7
68 + color: root.theme.ui.focus
69 + visible: (root.notification && (root.notification.image.length > 0 || root.notification.appIcon.length > 0))
71 + Image {
72 + anchors.fill: parent
73 + anchors.margins: 3
74 + source: root.notification ? (root.notification.image || root.notification.appIcon) : ""
75 + fillMode: Image.PreserveAspectFit
76 + asynchronous: true
77 + }
78 + }
80 + ColumnLayout {
81 + Layout.fillWidth: true
82 + Layout.fillHeight: true
83 + spacing: 4
85 + Text {
86 + Layout.fillWidth: true
87 + text: root.notification ? root.notification.appName : ""
88 + color: root.theme.ui.minor
89 + font.family: "IBM Plex Sans"
90 + font.pixelSize: 10
91 + elide: Text.ElideRight
92 + }
94 + Text {
95 + Layout.fillWidth: true
96 + text: root.notification ? root.notification.summary : ""
97 + color: root.theme.ui.important_global
98 + font.family: "IBM Plex Sans"
99 + font.pixelSize: 10
100 + font.bold: true
101 + elide: Text.ElideRight
102 + maximumLineCount: 1
105 + Text {
106 + Layout.fillWidth: true
107 + Layout.fillHeight: true
108 + text: root.notification ? root.notification.body : ""
109 + color: root.theme.ui.normal
110 + font.family: "IBM Plex Sans"
111 + font.pixelSize: 10
112 + wrapMode: Text.Wrap
113 + elide: Text.ElideRight
114 + maximumLineCount: 3
115 + textFormat: Text.RichText
116 + visible: text.length > 0
119 + RowLayout {
120 + Layout.fillWidth: true
121 + visible: root.notification && root.notification.actions.length > 0
122 + spacing: 6
124 + Repeater {
125 + model: root.notification ? root.notification.actions : []
127 + Rectangle {
128 + required property var modelData
129 + Layout.preferredHeight: 22
130 + Layout.preferredWidth: actionText.implicitWidth + 16
131 + radius: 6
132 + color: actionMouse.containsMouse ? root.theme.ui.accent : root.theme.ui.focus
134 + Text {
135 + id: actionText
136 + anchors.centerIn: parent
137 + text: modelData.text
138 + color: root.theme.content.backdrop
139 + font.family: "IBM Plex Sans"
140 + font.pixelSize: 10
141 + elide: Text.ElideRight
144 + MouseArea {
145 + id: actionMouse
146 + anchors.fill: parent
147 + hoverEnabled: true
148 + onClicked: {
149 + modelData.invoke()
150 + root.dismissRequested(root.notification)

quickshell/nugu/README.md

Modified
68 68 - clock calendar popup
70 70 Still deferred: native notification daemon, launcher bind replacement, full clipboard picker bind replacement, OSDs, Hypr bind migration, and retiring old services.
72 +## Phase 3 native notifications
74 +Phase 3 adds a native `NotificationServer`, disabled by default so it does not fight Mako.
76 +Controlled test flow:
78 +```sh
79 +systemctl --user stop mako.service
80 +qs ipc -c nugu call nugu enableNativeNotifications
81 +notify-send "hello" "body"
82 +qs ipc -c nugu call nugu dismissNativeNotifications
83 +qs ipc -c nugu call nugu disableNativeNotifications
84 +systemctl --user start mako.service
85 +```
87 +Do not disable Mako in dotfiles until native notification parity is proven and rollback is verified.

quickshell/nugu/shell.qml

Modified
10 10 // the parity checklist says it is safe to retire the old companions.
11 11 property bool diagnosticsVisible: false
12 12 property bool barVisible: false
13 + property bool nativeNotificationsEnabled: false
14 15 // One theme object is shared across all panels so dark/light changes are
15 16 // instant and every widget uses the same Nugu semantic palette.
39 40 return nuguTheme.mode
41 42 function themeMode(): string { return nuguTheme.mode }
44 + // Native notifications are opt-in while Mako is still live. Tests must stop
45 + // Mako first, enable this daemon, then rollback by disabling and restarting Mako.
46 + function enableNativeNotifications(): string {
47 + root.nativeNotificationsEnabled = true
48 + return "enabled"
49 + }
50 + function disableNativeNotifications(): string {
51 + root.nativeNotificationsEnabled = false
52 + return "disabled"
53 + }
54 + function nativeNotificationCount(): int {
55 + return notificationLoader.item ? notificationLoader.item.count : 0
56 + }
57 + function dismissNativeNotifications(): void {
58 + if (notificationLoader.item) notificationLoader.item.dismissAll()
59 + }
60 + function restoreNativeNotification(): void {
61 + if (notificationLoader.item) notificationLoader.item.restoreLast()
62 + }
63 + }
65 + Loader {
66 + id: notificationLoader
67 + active: root.nativeNotificationsEnabled
68 + sourceComponent: Component {
69 + NotificationDaemon { theme: nuguTheme }
70 + }
44 73 // Create one bar per monitor, matching Ironbar's multi-output behavior.