repositories / dotfiles

dotfiles

bugabingas dorkfiles

owned by bugabinga

spec: add replace-by-id identity model, resolve dismiss keybind

f342ca1d089f0fb26bacd45075514cc7e580e882

Oliver Jan Krylow <oliver@bugabinga.net> ·

unsigned

Browse filesCompare with HEAD

- Notification identity section: cards key on protocol id, update in
  place on replaces_id (progress/chat coalescing). Fixes the concat
  append-duplicate bug. x-canonical-private-synchronous tag optional.
- Super+Delete -> dismissToasts (visible toasts only); drops the
  Mod+ESCAPE conflict. History clear stays button-only.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>

Changed files (1)

quickshell/nuguland/docs/superpowers/specs/2026-06-27-notifications-redesign.md

Modified
77 77 **Core principle:** full mode = complete record (opened deliberately). compact mode = glanceable interrupt (summary + icon + urgency color). Urgency is the one field that changes *behavior*, not just looks.
79 +## Notification identity & replacement (replace-by-id)
81 +Notifications update in place via the freedesktop protocol's `replaces_id`, **not** via `hints.value`. Every notification carries a numeric `id`. An app updates an existing card by calling `Notify` again with `replaces_id = <that id>`; the server reuses the id and the card with that id updates. A progress bar (value 10→50→100) is the same id sent three times. Chat coalescing ("3 messages"→"4 messages") and now-playing updates work the same way.
83 +- **Cards key on `id`.** When an id reappears, **update the existing row in place** — do not append.
84 +- No `replaces_id` → new id → independent card.
85 +- Optional: honor `x-canonical-private-synchronous:<tag>` hint to coalesce by string tag (for clients that don't track the returned id, e.g. volume scripts). Lower priority.
87 +**Current bug this fixes:** `acceptNativeNotification` (Notifications.qml:144) always does `notifications.concat([row])`, so a replace duplicates the card instead of updating it. The redesigned model must dedup/update by id. This is in scope independent of progress bars (which stay out of scope). Quickshell's exact replace mechanics (mutate-in-place vs re-emit `onNotification` with the same id) must be **verified empirically** with `notify-send -p` / `notify-send -r ID`, not assumed.
79 89 ## Toast surface
81 91 New transient `PanelWindow`, top-screen, `WlrLayer.Overlay`, `keyboardFocus: None`, modelled on the existing OSD overlay (shell.qml:121). Renders a vertical stack of compact `NotificationCard`s for currently-active toasts.
97 107 Drop drag-to-dismiss entirely. Replace with:
99 109 - **× per card** (full mode) — fades in on hover, top-right. Calls `closeNotification(id)`.
100 -- **Clear all** — popup header, right side. Hidden/greyed when 0 notifications. Calls `discardAllNotifications()` (exists).
101 -- **Super+Esc** → `dismissToasts()` — clears all visible toasts without touching history.
110 +- **Clear all** — popup header, right side. Hidden/greyed when 0 notifications. Calls `discardAllNotifications()` (exists). History clear is button-only (never keyboard) — destructive, no undo.
111 +- **Super+Delete** → `dismissToasts()` — clears all visible toasts off-screen, history kept.
103 113 ## Popup header
117 127 Keep `stateJson()` and every field the renderer consumes. Add:
119 -- `dismissToasts()` → hide all visible toasts, keep history. **Bound to Super+Esc.**
129 +- `dismissToasts()` → hide all visible toasts, keep history. **Bound to Super+Delete.**
120 130 - Existing, retained: `closeNotification`/`runAction(id,"close")`, `discardAllNotifications()`, `toggleDnd()`, `toggleGroup(appName)`.
121 131 - Service must track `activeToasts` (ids currently shown as toasts) separately from history, and expose them in `stateJson()` so the toast window can render them.
135 145 Add to `niri/cfg/keybinds.kdl`:
136 146 ```kdl
137 -Mod+Escape ... { spawn ... "qs" "ipc" "-c" "nuguland" "call" "notifications" "dismissToasts" }
147 +Mod+Delete { spawn ... "qs" "ipc" "-c" "nuguland" "call" "notifications" "dismissToasts" }
139 -Note: `Mod+ESCAPE` is currently `toggle-keyboard-shortcuts-inhibit` (the emergency-escape bind). Reconcile — either rebind dismiss elsewhere or move the inhibit toggle. **Decision needed at plan time.**
149 +`Mod+Delete` is free — no conflict with the existing `Mod+ESCAPE` emergency `toggle-keyboard-shortcuts-inhibit` bind.
141 151 ## Files touched
152 162 - `notify-send -i firefox "Test" "Body text"` — icon + body.
153 163 - `notify-send -u critical "Alert" "Sticky"` — critical sticky + DND bypass.
164 +- `notify-send -p "DL" "10%"` then `notify-send -r <id> "DL" "50%"` — replace updates the **same** card, no duplicate.
154 165 - Screenshot notification (image thumbnail).
155 166 - `appIcon` is an icon **name** → must use `IconImage` (Quickshell.Widgets) for theme lookup, **not** plain `Image`. `image` is a path/url → plain `Image`. Confirm `image` survives the JSON-string round-trip and actually paints (screenshot before claiming success).