Skip to content

Give third-party critical notifications a finite popup lifetime - #13159

Closed
johnturek wants to merge 1 commit into
omacom:quattrofrom
johnturek:notifications-critical-lifetime
Closed

johnturek wants to merge 1 commit into
omacom:quattrofrom
johnturek:notifications-critical-lifetime

Conversation

@johnturek

Copy link
Copy Markdown

Fixes #13153

Problem

Notifications relayed by Chromium-based browsers (Teams PWA, YouTube, etc.) stay on screen until dismissed by hand. Chromium stamps urgency=critical on every web notification it forwards, and durationFor() in Service.qml mapped critical urgency to a lifetime of 0 (forever) regardless of who sent it. The persisted popup state confirms it:

{ "app": "Google Chrome", "urgency": 2, "expireTimeout": 0 }

The DND code already notes that chat apps abuse critical urgency, but the popup lifetime didn't apply the same skepticism.

Fix

Reserve the permanent popup for critical toasts from the same two senders the DND bypass already trusts: omarchy-action (Omarchy's own toasts — first-run hooks, battery-low, migrations) and notify-send (bare-CLI alerts). Critical toasts from any brand-named app fall through to the normal lifetime (8s, stretched up to 30s if the sender asked for a longer expire_timeout).

  • NotificationLogic.js: add keepsCriticalOnScreen(appName) so the rule is Node-testable
  • Service.qml: durationFor() takes the app name; both call sites (live card slot and restorePopups) pass it
  • docs/notifications.md: document the sender-aware rule in the toast lifecycle section

Behavior

Sender Urgency Before After
omarchy-action / notify-send critical forever forever (unchanged)
Google Chrome, Slack, Discord, … critical forever 8s (up to 30s if requested)
anything low / normal 5s / 8s unchanged

Restored popups after a shell restart follow the same rule, so a stuck Chrome toast persisted before this change is archived on the next restart instead of coming back.

Testing

  • test/shell.d/notifications-test.sh: five new assertions covering trusted senders, Chromium, chat apps, and an empty app name — all pass
  • ./test/shell: no new failures (remaining failures in config, kernel-headers-migration, omarchy-kernel-migration, snapper, unowned-system-paths reproduce identically on an untouched checkout in this environment)
  • Manual: linked the checkout with omarchy dev link, received a YouTube/Teams notification, confirmed it expired after 8s while omarchy-notification-send -u critical toasts still stay pinned

Chromium stamps urgency=critical on every web notification it relays, so
Teams/YouTube PWA toasts sat on screen until dismissed by hand. Reserve the
permanent popup for the same trusted senders the DND bypass recognizes
(omarchy-action, notify-send); brand-named apps fall through to the normal
lifetime.

Fixes omacom#13153

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
@llstrk

llstrk commented Sep 24, 2026

Copy link
Copy Markdown

Automated AI review

Community review: Independent automated community review, unaffiliated with the Omarchy team, intended to help prepare PRs for their review.

Verified: the change gives the payload reported in #13153 (app "Google Chrome", urgency critical, expire_timeout 0) a finite popup lifetime, and Omarchy's own critical toasts keep their permanent popup. The one substantive issue is the stated reason for the change: Chromium does not mark every web notification critical, so the docs and code comment describe a different trade-off from the one the code makes.

Sender and shape Base Head
Google Chrome, critical, expire 0 (the issue's payload) stays until dismissed 8 s
Google Chrome, normal, expire -1 (ordinary web notification) 8 s 8 s (unchanged)
omarchy-action, critical (Omarchy's own toasts) stays stays
notify-send without -a, critical stays stays
Other app name, critical, expire 20000 / 60000 stays 20 s / 30 s (cap)
Restored after restart: Chrome critical persisted more than 8 s earlier shown again, stays archived to history

Verified: both durationFor call sites (live card and restorePopups) pass the app name. DND decisions, low and normal durations, and the countdown restart on content updates are unchanged. notify-send without -a sends the app name notify-send (libnotify notify_init("notify-send")).

Chromium marks a notification critical only when the page sets requireInteraction

The PR description, docs/notifications.md and the new comment in NotificationLogic.js state that Chromium stamps critical urgency on every web notification. In the Chrome 154.0.8037.57 Linux notification bridge, that happens only for notifications that should never time out:

page: showNotification(title, { requireInteraction: true })
  -> set_never_timeout(true)                  platform_notification_service_impl.cc
  -> urgency CRITICAL, expire_timeout 0       notification_platform_bridge_linux.cc
     (on every server except KDE Plasma and wf-panel-pi; Quickshell reports "quickshell")

page: showNotification(title, {})              default
  -> urgency NORMAL, expire_timeout -1         already expires after 8 s on the base branch

Sources: bridge, web notification construction.

Impact: the fix still resolves the reported payload. However, a reader of the docs would conclude that no Chrome notification expires without this rule, and would not see that the rule overrides pages that explicitly asked to keep a notification until the user acts. When such a toast expires, Chromium reports it to the page as closed. The manual YouTube/Teams check in the PR description exercises the change only if that site sets requireInteraction; ordinary web notifications expired after 8 s before this PR too.

Suggested change: reword the docs and the code comment along these lines: "Chromium marks a web notification critical, with expire_timeout 0, when the page sets requireInteraction, so a critical toast from any other app name gets the normal 8s lifetime (or its requested expire_timeout, capped at 30s) instead." It may also help to note that the rule applies to every sender except omarchy-action and bare notify-send, so user scripts using a custom --app-name or notify-send -a with critical urgency also lose the permanent popup (the toast still moves to history).

Pre-existing, now more visible: with more than one screen, each screen renders its own copy of every toast with its own countdown and hover state, and expiry removes the shared row. Hovering a toast on one screen does not stop the copy on another screen from expiring it. Low and normal toasts on the base branch already behave this way; this PR extends it to third-party critical toasts. A fix (one countdown per row, or pausing every copy while any copy is hovered) would be a separate change.

Optional test improvement: the five new assertions call keepsCriticalOnScreen directly, and no test references durationFor or its two call sites. By source inspection, dropping the app argument at either call site would make Omarchy's own critical toasts expire after 8 s (or be archived on restart) with the suite still passing. Two source assertions in the file's existing Service.qml regex style, one per call site, would catch that.


Review information

Test scope: source review of the pinned head and base, plus upstream Chromium 154.0.8037.57, Quickshell 0.3.1 and libnotify notification sources. No repository tests, shell or GUI were run, and multi-screen behavior was not observed on real outputs. Which web apps (including Teams) set requireInteraction was not verified.

AI process: Opus 5.5 Medium coordination and synthesis, independent Opus 5.5 Xhigh and GPT 6 Sol Xhigh technical assessments with targeted follow-up questions, Opus 5.5 Medium editorial check.

Opt out: To stop receiving these reviews, reply to this comment saying so.

@jandrusk

jandrusk commented Oct 8, 2026

Copy link
Copy Markdown

Overlapping work to weigh against this:

Also, as the earlier review noted, Chromium doesn't stamp critical on every web notification, so the comment in keepsCriticalOnScreen and the docs should be softened.

@ryanrhughes

Copy link
Copy Markdown
Collaborator

Thanks @johnturek! I know the Chromium-stamps-everything-critical part is annoying. In the new notification engine (#15932) that's deliberate: critical means "stays until you dismiss it" (durationFor in Service.qml, and docs/notifications.md). Low and normal get 5s / 8s, stretched up to 30s by expire_timeout. Closing for that reason, but I appreciate the careful write-up.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement New feature or request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Chrome/Teams critical notifications never expire

5 participants