Menu β–Ύ β–΄

#36 Fix macOS Dock reopen and tray unread badge

closed
nobody
None
2026-06-30
2026-06-30
Anonymous
No

Originally created by: kristofferR

Summary

  • handle macOS Dock re-open by showing or recreating the main Messenger window when no app windows are visible
  • make the macOS tray icon left-click toggle the window without an attached status-item menu intercepting the click
  • show and clear the macOS tray title unread count according to the existing unread badge preference

Validation

  • cd src-tauri && cargo fmt && cargo clippy --all-targets -- -D warnings && cargo test --lib && node --check inject/messenger.js
  • bun run tauri build --debug --bundles app

Ref [#29]
Ref [#32]

Summary by CodeRabbit

  • New Features
  • Improved tray/menu and main-window show/hide behavior for smoother access and better macOS reopen handling.
  • Enhanced 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

  • Added macOS-only unit tests to verify unread title formatting for enabled, disabled, and zero-count states.

Related

Tickets: #29
Tickets: #32

Discussion

  • Anonymous

    Anonymous - 2026-06-30

    Originally posted by: kristofferR

    @coderabbitai review

     
  • Anonymous

    Anonymous - 2026-06-30

    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.
     
  • Anonymous

    Anonymous - 2026-06-30

    Originally posted by: coderabbitai[bot]

    Review Change Stack

    πŸ“ 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 help to get the list of available commands.

     
  • Anonymous

    Anonymous - 2026-06-30

    Originally posted by: kristofferR

    @coderabbitai review

     
  • Anonymous

    Anonymous - 2026-06-30

    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.
     
  • Anonymous

    Anonymous - 2026-06-30

    Ticket changed by: kristofferR

    • status: open --> closed
     

Log in to post a comment.