Skip to content

Pending-request notifications on Windows and Linux: remove when handled, click opens the request #1710

Backlog

Description

@smart-ssh-planner

Goal

On Windows and Linux, a pending-request notification disappears once its request is answered or the user returns to the app. Clicking the notification brings the app to the front and opens the tab of the request.

Context

  • Pending requests: native notification and Dock/taskbar attention while the app is in the background #1709 added:
    • the PendingRequestNotifier trait;
    • the desktop implementation and the OS notification backend boundary in crates/app-shell (show by id, remove by id, remove all);
    • activate_pending_request(id).
  • Its plugin-based backend (tauri-plugin-notification 2.4) can neither remove a delivered notification nor report a click on desktop.
  • tauri-plugin-notification uses notify-rust on Linux and tauri-winrt-notification on Windows; both are already in Cargo.lock.

Requirements

  • Linux backend (freedesktop notifications over D-Bus, e.g. notify-rust directly):
    • Keeps the NotificationHandle per request id.
    • Closes the notification on remove (CloseNotification).
    • Handles the default action (click) by calling activate_pending_request(id).
  • Windows backend (WinRT toast, tauri-winrt-notification or the windows crate):
    • Each toast carries a tag derived from the request id and a fixed group.
    • Remove uses ToastNotificationManager::History().Remove(tag, group, app_id).
    • Remove all uses RemoveGroup.
    • Activation (click) calls activate_pending_request(id).
    • Use the app's existing AppUserModelID; in dev builds without one, fall back to the plugin behaviour and log it.
  • Both backends:
  • Notifications never offer approve/deny actions. A click only focuses and switches the tab.

Acceptance Criteria

  • On Linux, a pending-request notification is closed when its request ends (approved, denied, timeout, tab closed) and when the main window gets focus.
  • On Linux, clicking the notification focuses the app and switches to the tab of the request.
  • On Windows, a toast is removed from the Action Center when its request ends and when the main window gets focus.
  • On Windows, clicking the toast focuses the app and switches to the tab of the request.
  • Without a usable notification service (no D-Bus session, no AppUserModelID), the app falls back to the plugin backend, logs once without content, and the request flow is unchanged.
  • Unit tests for the id-to-handle/tag mapping and for the remove-on-end / remove-all-on-focus logic, using a fake backend.
  • Relevant automated tests pass on the Linux and Windows CI jobs.

Technical Notes

  • Real desktop behaviour (Action Center, GNOME/KDE notification daemons) can only be checked by hand. The reviewer lists manual test steps per OS.
  • Keep each OS in its own module behind cfg(target_os).
  • No content in logs (Spec 0094).

Files: crates/app-shell/src/ (pending_request_notifications backend modules for linux and windows), crates/app-shell/Cargo.toml, Cargo.lock, docs/specs/ (pending-request notification spec)

Spec impact: update the pending-request notification spec created by #1709 (platform behaviour for Windows and Linux)

Open questions

  • Windows API choice: tauri-winrt-notification if it exposes tag/group and the activation callback (recommended, fewer dependencies), otherwise the windows crate with UI_Notifications.

Related Work

Metadata

Metadata

Assignees

No one assigned

    Labels

    app-shellenhancement

    Fields

    Priority

    P2 - Normal

    Projects

    No projects

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions