Fix macOS Dock reopen and tray unread badge
Facebook Messenger on your desktop, without the Facebook clutter
Brought to you by:
kristoffer-r
Originally created by: kristofferR
cd src-tauri && cargo fmt && cargo clippy --all-targets -- -D warnings && cargo test --lib && node --check inject/messenger.jsbun run tauri build --debug --bundles appEnhanced unread badge support so the tray/Dock title displays unread counts only when enabled.
Bug Fixes
Improved tray icon interaction patterns (left/right click + state) for more consistent window and tray menu behavior across platforms.
Tests
Originally posted by: kristofferR
@coderabbitai review
Originally posted by: coderabbitai[bot]
β Action performed
Review finished. > Note: CodeRabbit is an incremental review system and does not re-review already reviewed commits. This command is applicable only when automatic reviews are paused.Originally posted by: coderabbitai[bot]
π Walkthrough
## Walkthrough Refactors window reveal logic, updates tray menu and click handling for macOS, gates unread tray titles on settings, adds macOS reopen handling, and adds tests for tray title formatting. ## Changes **Tray and Window Behavior Refactor** | Layer / File(s) | Summary | |---|---| | **reveal_window helper and show_main/toggle_main cleanup**`src-tauri/src/lib.rs` | Extracts show, unminimize, and focus calls into `reveal_window`, and routes `show_main` and the existing-window branch of `toggle_main` through it. | | **Tray menu construction and macOS-specific handlers**
`src-tauri/src/lib.rs` | Adds tray menu construction, macOS-only tray menu display, tray title formatting, tray click button/state matching, and OS-specific tray builder behavior. | | **carrier:unread listener and macOS Reopen handling**
`src-tauri/src/lib.rs` | Updates the `carrier:unread` listener to gate tray counts and titles on `settings.unread_badge`, and adds a macOS `RunEvent::Reopen` branch that can show the main window when none are visible. | | **Unit tests for `tray_unread_title`**
`src-tauri/src/lib.rs` | Adds macOS-only tests for `tray_unread_title` covering enabled positive counts and zero or disabled cases returning `None`. | ## Estimated code review effort π― 2 (Simple) | β±οΈ ~15 minutes ## Possibly related PRs - [[kristofferR/Carrier#2](https://github.com/kristofferR/Carrier/issues/2)](https://github.com/kristofferR/Carrier/pull/2): Directly overlaps with tray/window badge plumbing and the ability to set Dock/taskbar badge counts. - [[kristofferR/Carrier#11](https://github.com/kristofferR/Carrier/issues/11)](https://github.com/kristofferR/Carrier/pull/11): Both PRs touch macOS unread badge/title handling and the settings that gate it. ## Poem > π° Hop, hop, the tray now knows the way, > Left-click shines the window; right-click has its say. > Unread counts stay quiet when settings say no, > And Reopen brings back the main-window glow. > Tiny tests nibble the title just right, > Then the rabbit bounces off into the night.
π₯ Pre-merge checks | β 5
β Passed checks (5 passed)
| Check name | Status | Explanation | | :------------------------: | :------- | :------------------------------------------------------------------------------------------------- | | Description Check | β Passed | Check skipped - CodeRabbitβs high-level summary is enabled. | | Title check | β Passed | The title clearly matches the main macOS Dock reopen and tray unread badge changes and is concise. | | Docstring Coverage | β Passed | Docstring coverage is 91.67% which is sufficient. The required threshold is 80.00%. | | Linked Issues check | β Passed | Check skipped because no linked issues were found for this pull request. | | Out of Scope Changes check | β Passed | Check skipped because no linked issues were found for this pull request. |β¨ Finishing Touches
π Generate docstrings
- [ ] Create stacked PR - [ ] Commit on current branchπ§ͺ Generate unit tests (beta)
- [ ] Create PR with unit tests - [ ] Commit unit tests in branch `codex/fix-29-32`Comment
@coderabbitai helpto get the list of available commands.Originally posted by: kristofferR
@coderabbitai review
Originally posted by: coderabbitai[bot]
β Action performed
Review finished. > Note: CodeRabbit is an incremental review system and does not re-review already reviewed commits. This command is applicable only when automatic reviews are paused.Ticket changed by: kristofferR