Repository navigation
Keep clicking a notification working after a shell restart - #6636
Conversation
Notification actions lived only in the sending process: `-a` appended `-A default=default`, so notify-send blocked on a D-Bus ActionInvoked signal and the caller ran the command when it arrived. Nothing about that reached disk, so a restored popup had no action to run and its sender stayed blocked forever. Replace `-a` with `--exec <command>`, carried as an `omarchy-exec` hint into the snapshot's `exec` role. It travels through the popup files and history, and the shell runs it on click, so restored toasts behave exactly like live ones and the sender exits immediately. That drops the scaffolding whose only job was keeping a blocked sender alive: the first-run invitations lose their `--show` re-entry and two transient units each, omarchy-migrate-notify loses its transient service, and the screenshot, recording, download, and taildrop toasts lose their wrapper subshells. Co-Authored-By: Claude Opus 5 (1M context) <[email protected]>
There was a problem hiding this comment.
Pull request overview
Persists notification click commands so actions survive shell restarts and senders no longer block awaiting D-Bus responses.
Changes:
- Adds
--execcommand hints and shell-side execution. - Migrates actionable notifications away from libnotify actions.
- Updates notification persistence and tests.
Tip
If you aren't ready for review, convert to a draft PR.
Click "Convert to draft" or run gh pr ready --undo.
Click "Ready for review" or run gh pr ready to reengage.
Reviewed changes
Copilot reviewed 12 out of 18 changed files in this pull request and generated 1 comment.
Show a summary per file
| File | Description |
|---|---|
bin/omarchy-notification-send |
Adds --exec hint support. |
shell/plugins/notifications/NotificationLogic.js |
Persists click commands. |
shell/plugins/notifications/Service.qml |
Executes persisted commands. |
bin/omarchy-migrate-notify |
Removes transient notification service. |
bin/omarchy-tailscale-receive |
Attaches file-opening commands. |
bin/omarchy-chromium-ytdlp-host |
Attaches video action and delayed cleanup. |
bin/omarchy-capture-screenshot |
Attaches editor action. |
bin/omarchy-capture-screenrecording |
Attaches playback action and cleanup. |
install/user/first-run/wifi.sh |
Migrates setup notification actions. |
install/user/first-run/welcome.sh |
Migrates keybindings invitation. |
install/user/first-run/setup-fingerprint.hook |
Simplifies fingerprint invitation. |
install/user/first-run/install-voxtype.hook |
Simplifies Voxtype invitation. |
test/shell.d/notification-send-test.sh |
Tests --exec parsing. |
test/shell.d/notifications-test.sh |
Tests command persistence. |
test/shell.d/migrate-notify-test.sh |
Tests direct notification handoff. |
test/shell.d/tailscale-receive-test.sh |
Tests quoted open commands. |
test/shell.d/fingerprint-invitation-test.sh |
Tests persisted setup action. |
test/shell.d/voxtype-invitation-test.sh |
Tests persisted installer action. |
💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.
| if (command) { | ||
| // Detached so the launched command outlives the shell process, which the | ||
| // installer toasts depend on: they restart the shell as their first act. | ||
| Util.execDetached(command) |
There was a problem hiding this comment.
Flagged in the PR body as a known property of the design, so this is a fair callout — but the proposed mitigation is harder than it looks, and I'd rather be explicit about why it isn't in this PR.
An opaque handle only helps if the registry backing it is somewhere a sandboxed app can't write:
$XDG_RUNTIME_DIRis the one place flatpak genuinely can't reach (it gets a private runtime dir, so it can't touch the shell's IPC socket either). But it doesn't survive a reboot, and these invitations are-u critical→ duration0→ they persist indefinitely on purpose. A runtime-dir handle would leave the click dead after a reboot, which is the exact bug this PR fixes.~/.local/statesurvives reboots but weakens the authentication, since flatpaks commonly hold--filesystem=homeand could write the registry directly.- Whitelisting
omarchy-*commands isn't a boundary at all:omarchy-launch-floating-terminal-with-presentation <cmd>runs arbitrary commands, so it's still a full escape.
On the exposure itself: the attack needs a malicious app and a user click, and only pays off inside a sandbox — a native package already runs with full user privileges, so it gains nothing from the hint. Flatpak isn't in Omarchy's default package set either; it appears only as an opt-in path (GeForce NOW, LocalSend detection).
The honest version of your suggestion is a handle registered over the shell's own IPC socket and persisted to a shell-owned file in the state dir. That does raise the bar for sandboxes without home access, at the cost of a registry lifecycle (GC on dismiss/expire, and leaked entries whenever DND suppresses a toast). Worth doing as a follow-up if Omarchy wants to treat sandboxed senders as untrusted, but it's a separate change from restoring click-through, and it shouldn't ride along on a bug fix.
— 🤖 Claude, posting on behalf of @dhh
Moving these sends out of their backgrounded subshells put a fallible command on the foreground path, where the `&` used to swallow its exit status. A notification outage — including the shell restart this branch targets — now propagates: - taildrop's receiver dies under `set -e` mid-delivery - omarchy-capture-screenshot reports failure for a screenshot it already saved - a completed download exits before scheduling its thumbnail cleanup, leaking the mktemp file Announcing is best-effort in all three: the work is already done by the time the toast goes out. Also drop the first-run sleep that spaced out the welcome and Wi-Fi toasts. It compensated for the background notify-send processes this branch removes; each send now returns only once the server has taken the toast, so sending in order is enough to stack them newest-on-top. Co-Authored-By: Claude Opus 5 (1M context) <[email protected]>
The shell loads a notification thumbnail into memory when the toast appears and never re-reads the file, so the preview only has to outlive that load. Deriving the cleanup delay from the expiry was false precision, and it turned -t into a variable for no reason: -t is already the helper's expiry setting. Co-Authored-By: Claude Opus 5 (1M context) <[email protected]>
* Keep clicking a notification working after a shell restart Notification actions lived only in the sending process: `-a` appended `-A default=default`, so notify-send blocked on a D-Bus ActionInvoked signal and the caller ran the command when it arrived. Nothing about that reached disk, so a restored popup had no action to run and its sender stayed blocked forever. Replace `-a` with `--exec <command>`, carried as an `omarchy-exec` hint into the snapshot's `exec` role. It travels through the popup files and history, and the shell runs it on click, so restored toasts behave exactly like live ones and the sender exits immediately. That drops the scaffolding whose only job was keeping a blocked sender alive: the first-run invitations lose their `--show` re-entry and two transient units each, omarchy-migrate-notify loses its transient service, and the screenshot, recording, download, and taildrop toasts lose their wrapper subshells. Co-Authored-By: Claude Opus 5 (1M context) <[email protected]> * Keep a failed toast from failing the work it announces Moving these sends out of their backgrounded subshells put a fallible command on the foreground path, where the `&` used to swallow its exit status. A notification outage — including the shell restart this branch targets — now propagates: - taildrop's receiver dies under `set -e` mid-delivery - omarchy-capture-screenshot reports failure for a screenshot it already saved - a completed download exits before scheduling its thumbnail cleanup, leaking the mktemp file Announcing is best-effort in all three: the work is already done by the time the toast goes out. Also drop the first-run sleep that spaced out the welcome and Wi-Fi toasts. It compensated for the background notify-send processes this branch removes; each send now returns only once the server has taken the toast, so sending in order is enough to stack them newest-on-top. Co-Authored-By: Claude Opus 5 (1M context) <[email protected]> * Stop tying the preview cleanup to the toast's expiry The shell loads a notification thumbnail into memory when the toast appears and never re-reads the file, so the preview only has to outlive that load. Deriving the cleanup delay from the expiry was false precision, and it turned -t into a variable for no reason: -t is already the helper's expiry setting. Co-Authored-By: Claude Opus 5 (1M context) <[email protected]> --------- Co-authored-by: Claude Opus 5 (1M context) <[email protected]>
Summary
Notifications with actions stopped working once they were restored after a shell restart — clicking the voxtype or keybindings invitation did nothing.
The action lived only in the sending process.
omarchy-notification-send -aappended-A default=default, sonotify-sendblocked waiting for a D-BusActionInvokedsignal and the caller ran the command when it arrived. None of that reached disk, so a restored row had no action to run — and it can't be recovered over D-Bus either, since the new server hands out ids from 1 again and cannot emitActionInvokedfor the dead generation's id.invokePopupDefaultthen fell through to focusingomarchy-action(a no-op), while the originalnotify-sendstayed blocked forever.So the action becomes data that persists alongside the popup.
--exec <command>replaces-a: it travels as anomarchy-exechint into the snapshot'sexecrole, through the popup files and history, and the shell runs it on click viaUtil.execDetached. Restored toasts now behave exactly like live ones, and the sender exits immediately instead of blocking until the click.That let a lot of scaffolding go, all of which existed only to keep a blocked sender alive:
--showre-entry and twosystemd-runtransient units eachomarchy-migrate-notifyloses its transient service, so the oneshot no longer stays activated waiting for an answeromarchy-tailscale-receiveno longer backgrounds each announcementUsage
Interpolate paths with
printf %q, since the shell runs the command throughbash -lc:Breaking
-a/--actionis removed. Every call site was in this repo, and the flag was Omarchy's own invention, but a user script passing-awill now fail on the missing value. Passing-A default=defaultstraight through tonotify-sendstill works for anyone who wants the libnotify round-trip.Note
The shell now executes a command string carried in a D-Bus hint. That's no privilege escalation — the sender already runs as the user — but a sandboxed app with notification-portal access could get the host shell to run a command if the user clicks its toast. QML has no access to the D-Bus sender, so there's no way to restrict the hint to trusted senders.
— 🤖 Claude, posting on behalf of @dhh