Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

tauri: feat: add taskbar "unread" badge on Windows #4935

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

WofWca
Copy link
Collaborator

@WofWca WofWca commented Apr 5, 2025

As I said in the comments, Tauri's setBadgeCount is not supported
on Windows.

This will not show the count, but only the fact
that there is a new message.
This is not ideal, but it's better than nothing.

image

TODO:

  • Verify that this doesn't break the app for non-Windows targets (try the preview builds).

As I said in the comments, Tauri's `setBadgeCount` is not supported
on Windows.

This will not show the count, but only the fact
that there is a new message.
This is not ideal, but it's better than nothing.
@WofWca WofWca added this to the Tauri Project milestone Apr 5, 2025
@WofWca WofWca added OS: Windows This issue or PR is related to Windows OS Runtime: Tauri Issue affecting the tauri runtime specifically labels Apr 5, 2025
@WofWca WofWca marked this pull request as ready for review April 5, 2025 21:34
@Simon-Laux
Copy link
Member

I'd rather have us contribute to tauri to fix that it is not supported... But this already is an improvement.

Comment on lines +515 to +517
window.setOverlayIcon?.(
value === 0 ? undefined : 'images/tray/unread-badge.png'
)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

would make sense to only run this on windows. you could pass that info to here via RuntimeInfo

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I would also prefer that. But this function is Windows-only as of now, So I suggest to keep it as is until the badge counter is supported by Tauri, or until we are otherwise forced to do it.

@WofWca
Copy link
Collaborator Author

WofWca commented Apr 6, 2025

Yes, I considered that.

I think we should implement the proper counter in Tauri though, and not just a binary badge.
The former takes more effort though.

@Simon-Laux
Copy link
Member

Simon-Laux commented Apr 6, 2025

I think we should implement the proper counter in Tauri though, and not just a binary badge.
The former takes more effort though.

I don't think so, it is a windows api: https://learn.microsoft.com/en-us/uwp/api/windows.ui.notifications.badgenotification?view=winrt-26100#definition

not sure if this crate would be used or a different one that is smaller: https://microsoft.github.io/windows-docs-rs/doc/windows/UI/Notifications/struct.BadgeNotification.html - not sure what tauri uses to access windows api, I would try to work with what tauri uses first.

Though for older windows, the overlay icon method might still make sense, though I don't think we will spend resources to port to windows 7.

@WofWca
Copy link
Collaborator Author

WofWca commented Apr 6, 2025

I don't think so, it is a windows api: https://learn.microsoft.com/en-us/uwp/api/windows.ui.notifications.badgenotification?view=winrt-26100#definition

Hmmm. I assumed that it's not supported because Windows only exposes the "overlay icon" thing.

@Simon-Laux
Copy link
Member

Hmmm. I assumed that it's not supported because Windows only exposes the "overlay icon" thing.

it is mostly about what tauri supports of on the platforms, real badges are just not implemented yet is seems.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
OS: Windows This issue or PR is related to Windows OS Runtime: Tauri Issue affecting the tauri runtime specifically
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants