Skip to content

feat: Add unread message badge to system tray icon#1605

Open
kupietz wants to merge 1 commit into
nextcloud:mainfrom
kupietz:system-tray-unread-badge
Open

feat: Add unread message badge to system tray icon#1605
kupietz wants to merge 1 commit into
nextcloud:mainfrom
kupietz:system-tray-unread-badge

Conversation

@kupietz

@kupietz kupietz commented Dec 21, 2025

Copy link
Copy Markdown

Shows numbered badge (1, 2, 15, 99+) on tray icon when there are unread conversations, respecting notification settings.

Features:

  • Canvas-based badge rendering using offscreen BrowserWindow
  • Respects notification settings per conversation
  • Event-driven updates via store.subscribe() (no polling!)

☑️ Resolves

🖼️ Screenshots

🏚️ Before 🏡 After
image image

@kupietz
kupietz force-pushed the system-tray-unread-badge branch 2 times, most recently from fe957d7 to 06f6a62 Compare December 21, 2025 06:54
@github-actions

github-actions Bot commented Jan 5, 2026

Copy link
Copy Markdown
Contributor

Hello there,
Thank you so much for taking the time and effort to create a pull request to our Nextcloud project.

We hope that the review process is going smooth and is helpful for you. We want to ensure your pull request is reviewed to your satisfaction. If you have a moment, our community management team would very much appreciate your feedback on your experience with this PR review process.

Your feedback is valuable to us as we continuously strive to improve our community developer experience. Please take a moment to complete our short survey by clicking on the following link: https://cloud.nextcloud.com/apps/forms/s/i9Ago4EQRZ7TWxjfmeEpPkf6

Thank you for contributing to Nextcloud and we hope to hear from you soon!

(If you believe you should not receive this message, you can add yourself to the blocklist.)

@kupietz
kupietz force-pushed the system-tray-unread-badge branch from 06f6a62 to 590ed01 Compare March 3, 2026 12:11
@nickvergessen
nickvergessen requested a review from ShGKme March 3, 2026 12:25
Shows numbered badge (1, 2, 15, 99+) on tray icon when there are
unread conversations, respecting notification settings.

Features:
- Canvas-based badge rendering using offscreen BrowserWindow
- Respects notification settings per conversation
- Event-driven updates via store.subscribe() (no polling!)

(Pertially?) resolves nextcloud#391

Signed-off-by: Marc Kupietz <kupietz@ids-mannheim.de>
@kupietz
kupietz force-pushed the system-tray-unread-badge branch from 590ed01 to 693f19b Compare June 14, 2026 13:01
@kupietz

kupietz commented Jun 14, 2026

Copy link
Copy Markdown
Author

Successfully rebased on v2.2.0

@Flofler

Flofler commented Jul 3, 2026

Copy link
Copy Markdown

Could someone please review this merge request? I’ve tested it successfully and it works perfectly. This is a must-have feature for my colleagues and me. We frequently overlook notifications because we don't want to keep the window open all the time—plus, the current setup doesn't work well when using multiple workspaces.

// Wait for store to be available, then subscribe to mutations
const checkAndSubscribe = () => {
// eslint-disable-next-line @typescript-eslint/no-explicit-any
const store = (window as any).OCA?.Talk?.instance?.$store

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

First of all, thanks for the contribution!

I'm concerned, that this would not survive a planned migration to a different state manager.

There is already a public event introduced to provide these computations on web:

emit('talk:unread:updated', {
	conversations: number,
	messages: number,
	mentions: number,
	mentionsDirect: number,
})

@kupietz kupietz Jul 4, 2026

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

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

First of all, thanks for the contribution!

I'm concerned, that this would not survive a planned migration to a different state manager.

There is already a public event introduced to provide these computations on web:

emit('talk:unread:updated', {
	conversations: number,
	messages: number,
	mentions: number,
	mentionsDirect: number,
})

Thanks for the helpful hint and the review! Good point. I'll rework the integration to use the public talk:unread:updated (and rebase onto current main and fix the lint error while at it).

One small issue with the public event: unlike in my original PR, the public event's counters don't take per-conversation notification settings into account, so muted conversations will count as well. This is not nice, but no big issue for me. I hope for everybody else, too (opinions welcome!).

That said, maybe we can extend the event's payload in a follow-up PR to spreed with an additional counter that respects notification settings.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Sure, we can adjust payload upstream as well to respect notification settings / count additionally.

But I would wait for @ShGKme to give a general opinion on the code change before implementation, so we and you don't spend more time going back and forth with reviews and adjustments =)

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

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

Sounds good! Waiting for @ShGKme is fine, I've had some practice since December =)
The rework for using the public event is no big deal, it's mostly done already anyway.

@Antreesy Antreesy added enhancement New feature or request design labels Jul 4, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants