Skip to content

fix(notifications): suppress focused notifications and activate posting window on Linux - #1394

Merged
Hona merged 1 commit into
devfrom
fix/linux-notifications-focus-activate
Nov 27, 2026
Merged

Hona merged 1 commit into
devfrom
fix/linux-notifications-focus-activate

Conversation

@Hona

@Hona Hona commented Nov 27, 2026

Copy link
Copy Markdown
Member

Fixes #1295.

Credit to @zce for the root-cause analysis and proposed design.

What changed

  • Track per-window OS focus state from on_focus in apps/desktop/src/workspace/windows/ (Open::has_focus, windows::set_focused, windows::any_focused, windows::app_focused), clearing focus when a window hides or closes.
  • Implement NotificationsHost::is_window_focused() on App and update App::poll_taskbar() to call windows::app_focused(self). On macOS and Windows this still delegates directly to rune_notify::app_focused(); on Linux, where rune_notify::app_focused() returns false unconditionally, it uses the tracked window focus state so notifications and waiting alerts are suppressed while focused.
  • Add NotificationsHost::activate_window(&mut self, token: Option<&str>) (defaulting to rune_notify::bring_to_front()) and pass click.activation_token() from features/notifications/src/lib.rs::poll for toast-body and extension notification clicks while keeping inline permission/question button clicks answer-only.
  • On Linux, App::activate_window forwards non-empty tokens to the posting window's WindowHandle::activate(token) (available in the currently pinned Rune revision via anomalyco/rune#2502) and falls back to WindowHandle::focus() when no token is present. macOS and Windows continue calling rune_notify::bring_to_front().

Verification

  • pwsh scripts/guardrails.ps1 — passed (10/10).
  • cargo check -p opencode-feature-notifications — passed.
  • cargo clippy --no-deps -p opencode-feature-notifications -- -D warnings — passed.
  • Not run locally: full apps/desktop compile (no nasm installed on this Windows machine for rav1d) and live Linux Wayland/X11 desktop hardware (GNOME/mutter) were not run locally.

@Hona
Hona merged commit 6d7be89 into dev Nov 27, 2026
7 checks passed
@Hona
Hona deleted the fix/linux-notifications-focus-activate branch November 27, 2026 12:37
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Linux: notifications post while the window is focused, and a click doesn't raise it

1 participant