Repository navigation
The desktop app notifies of new messages and reactions and badges its unread count - #207
Merged
Merged
Conversation
… unread count A notification per message come in and per reaction to ours, through GPUI's system notifications, worded as the Mac app's; none while the window is in front or for a muted chat. A click opens the chat, Mark as Read marks it read. They are taken back when their chat is opened, read or deleted, and when their message is deleted or disappears. The unread count shows on the Dock (macOS) and on the launcher (Linux, the Unity LauncherEntry signal).
… review The tag carries the chat's opaque id, so a click or Mark as Read on a notification from an earlier run finds its chat; a click in the open chat takes back its other notifications; an expired message's notification goes also when shown in an earlier run (macOS). The mute-end wait is re-armed only when the next end changes. Failures are logged (ids and errors only), the Linux launcher count stays out of tests, and comments say what the code does.
Owner
Author
Review (
|
This was referenced Nov 14, 2026
Merged
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What changed
The desktop app (
core/desktop) now does what the Mac app'sNotifications.swift,AppStore.notifyandChatList.badgedo, through GPUI's system notifications. Everything is in a new module,src/app/notifications.rs. The shared files only gain small hooks.CoreEvent::NewMessage) and each reaction to one of our messages (NewReaction). None while the window is in front and on screen, none for a muted chat (asked of the core at that moment, as on the Mac), none for a message already deleted.opaque_ids, as on the Mac (the system keeps them).mark_read, throughchats::change). The tag starts with the chat's opaque id (the Mac app keeps it inuserInfo), so a notification from an earlier run still finds its chat once the chats are loaded.MessageExpired; on macOS this also removes one shown in an earlier run, by its tag), or is deleted for everyone (re-checked onMessageChanged). A click in the chat already open takes back that chat's other notifications too.ChatList.badgedoes: unread messages in chats that aren't archived or muted, plus one per chat marked unread. It is counted again when a timed mute ends (recountWhenAMuteEnds).main.rssets the app identity (dev.pitis.HushDesktop, "Hush"), which unpackaged Windows apps need before they can show toasts. On Linux the window'sapp_idis set to the same id, so the launcher can match the count to the window.Dependencies
No new crates;
Cargo.lockonly gains edges. GPUI has no badge API, so the badge needs:objc2,objc2-app-kit(NSApplication,NSDockTile) andobjc2-foundation(NSString), all already GPUI's own dependencies.zbus5, already pulled in by the keyring's Secret Service store, with the same default features.How it was tested
Unit tests, which fail against stubs:
Window tests on GPUI's test platform, which records notifications:
Unit tests also cover the tag: opaque ids only, one per reactor, and the chat found from it.
With the hooks in
mod.rsremoved, two of the three window tests fail.The Linux
show_badgewas compiled on macOS against zbus 5.19.0 in a scratch crate, to check the types.Gate:
make format;make lint(clippy-D warnings, plain and withhush-desktop/snapshot);cd core && cargo test -q --features hush-desktop/snapshot(193 desktop, 537 core).Swift leg: nothing it builds changed (no
sig-coreorapp/change).No snapshots: nothing is drawn in the window.
Not verified
cargo runhas none, so it skips them; GPUI's owninfoline about it doesn't reach the core's log). The live window can't be captured here, so neither a real notification nor the Dock badge was seen.dev.pitis.HushDesktop.desktoplauncher is installed. No packaging ships one yet.Decisions for the owner
org.freedesktop.Notificationsourselves.ITaskbarList3::SetOverlayIcon). That isn't done here: it would be untested code for icons drawn at runtime. Ashortcut:comment marks the spot.Closes #146