Unread count on the Windows taskbar icon #52

Closed
opened 2026-10-27 01:55:01 +00:00 by bmt · 1 comment
Member

request: show a badge with the number of unread messages on the taskbar icon

request: show a badge with the number of unread messages on the taskbar icon
ann referenced this issue from a commit 2026-10-27 08:55:40 +00:00
The unread count on the Windows taskbar button (#52, "show a badge with the number of unread messages on the taskbar icon"): Tauri's set_badge_count does nothing on Windows, so unread_badge (src-tauri/src/badge.rs) now puts the count on the calling window's taskbar button as its overlay icon through ITaskbarList3::SetOverlayIcon (made with CoCreateInstance on the main thread, where the webview has COM up), a 32-bit icon from CreateIcon at the system's small-icon size, its accessible description the number; 0 clears it. The taskbar forgets an overlay when it makes the button again (the window shown after hiding to the tray, Explorer restarted), so each window is subclassed once and its last count put back on the registered TaskbarButtonCreated message, the subclass and its entry dropped on WM_NCDESTROY. The pixels are the new plain-std src-tauri/src/overlay_badge.rs: "1" to "99", then "99+", white in a 3x5 pixel font scaled to the largest whole step that fits inside a red disc (the tray dot's red), BGRA with straight alpha, and an all-clear AND mask padded to 16-bit rows. Cargo.toml's windows crate gains the features Win32_System_Com and Win32_UI_WindowsAndMessaging (Cargo.lock unchanged); docs/push.md and the unread.ts comment say it. Untested on real Windows. Tests: overlay_badge.rs, 6 under make test-shell (the labels and the 99+ cap, every glyph there, the square's size with clear corners and a red rim at 16 to 48 px, the text white and inside the disc for 1, 8, 42 and 99+, one digit drawn larger than three, the mask's size). The shell cross-built for x86_64-pc-windows-gnu in the windows image (docker/tauri-windows.sh over a copied libtacky-win.a), the setup and the portable zip made, no warning from the crate. CHANGELOG Unreleased: Fixes #52. make check STRICT=1 clean (2031 keys), make test-ui 366 files, 3986 passed, 8 skipped, make test-shell ok.
ann closed this issue 2026-10-27 08:55:40 +00:00
Owner

Implemented: on Windows the taskbar button now shows the unread count as a small red badge (the taskbar's overlay icon), "1" to "99", then "99+", and it goes away when everything is read. It should also come back after the window is hidden to the tray and shown again, or after Explorer restarts.

It is untested on real Windows: it builds for Windows here but could only be checked by its unit tests. Please try 0.7.7 when it is out and say whether the badge shows, updates and clears. Note that Windows hides overlay badges when the taskbar uses small buttons (Taskbar settings, "Show badges on taskbar buttons" / small taskbar icons).

On develop in faf31823.

Implemented: on Windows the taskbar button now shows the unread count as a small red badge (the taskbar's overlay icon), "1" to "99", then "99+", and it goes away when everything is read. It should also come back after the window is hidden to the tray and shown again, or after Explorer restarts. It is untested on real Windows: it builds for Windows here but could only be checked by its unit tests. Please try 0.7.7 when it is out and say whether the badge shows, updates and clears. Note that Windows hides overlay badges when the taskbar uses small buttons (Taskbar settings, "Show badges on taskbar buttons" / small taskbar icons). On `develop` in faf31823.
Sign in to join this conversation.
No milestone
No project
No assignees
2 participants
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set

Reference
another-im/anotherim-js#52
No description provided.