Menu ▾ ▴

#183 Windows: unread count as a taskbar overlay badge

closed
nobody
2026-08-28
2026-07-22
Anonymous
No

Originally created by: kristofferR

On Windows the unread count exists only in the tray tooltip: set_badge_count is a documented no-op there ("use set_overlay_icon instead"). Tauri 2 exposes the Windows-only WebviewWindow::set_overlay_icon(Option<Image>) (verified: reaches ITaskbarList4::SetOverlayIcon via tao). Depends on [#168] landing first — reuses its tray_badge.rs rendering (Ref [#168]).

Design

  • Rendering: widen tray_badge.rs's cfg to include Windows; add overlay_badge_rgba(count) -> Option<Vec<u8>> at 32×32 (overlays render at 16 px effective; 32 gives 200 % DPI headroom): full-canvas Messenger-red AA circle with the bucketed digits (1–9, 9+), no base logo — Windows overlay icons are badge-only, the app icon is already the taskbar button. None for count ≤ 0. Reuse [#168]'s bucketing so the image regenerates only on bucket change.
  • Wiring: in the existing carrier:unread listener in lib.rs (which already zeroes the count when unread_badge is off — no new settings logic), a #[cfg(windows)] block builds the image (Image::new_owned(rgba, 32, 32)) and calls set_overlay_icon on every Messenger window except settings (each has its own taskbar button), None to clear. Cache the rendered RGBA per bucket but always call set_overlay_icon — the call is cheap/idempotent, and this makes theme-change window rebuilds and new windows self-healing via the page's periodic re-emit (no extra plumbing).
  • Known limitation: SetOverlayIcon's accessibility description parameter is hardcoded to None in tao — can't be set from Tauri today. Ship without; the count stays available via the tray tooltip. Consider filing upstream to plumb it through.
  • Edge cases: hide_taskbar_icon (skip-taskbar) → the call is a harmless no-op (tao swallows errors); Windows "small taskbar buttons" mode suppresses overlays at the OS level (expected behavior); payload is page-controlled and already clamped.

Testing. Unit (any OS): overlay_badge_rgba(0)/negative → None; 32×32×4 size; digit vs 9+ buffers differ; bucket boundaries (shared with [#168]). Manual (Win10/11 VM): badge appears bottom-right of the taskbar button; 9+ at 10+; clears fully on read; toggling the unread-badge setting clears/restores; second Messenger window badges too; theme-change rebuild self-heals within ~5 s; legible at 100 % and 200 % scaling.

Part of [#187].

Related

Tickets: #168
Tickets: #187
Tickets: #233

Discussion

  • Anonymous

    Anonymous - 2026-08-28

    Originally posted by: kristofferR

    Implemented in PR [#233] and manually verified on Windows 11 during PR [#247]. Taskbar overlay badges display the unread buckets, clear on read, and follow the existing unread badge setting. Closing as complete.

     

    Related

    Tickets: #233
    Tickets: #247

  • Anonymous

    Anonymous - 2026-08-28

    Ticket changed by: kristofferR

    • status: open --> closed
     

Log in to post a comment.