Skip to content

Show the full 127-unit tray tooltip by setting cbSize in a vendored tray-icon - #1015

Merged
Finesssee merged 6 commits into
mainfrom
fix/tray-icon-cbsize
Oct 24, 2026
Merged

Finesssee merged 6 commits into
mainfrom
fix/tray-icon-cbsize

Conversation

@Finesssee

@Finesssee Finesssee commented Oct 23, 2026 •

Copy link
Copy Markdown
Collaborator

Summary

Follow-up to #1007. tray-icon 0.21.3 builds every NOTIFYICONDATAW with ..zeroed() and never sets cbSize, so Explorer reads the pre-Windows 2000 layout and shows only the first 64 UTF-16 units of the tooltip. #1007 fitted the tooltip into that 64-unit tip, which leaves room for one provider line.

Tauri 2 requires tray-icon 0.21.x, and 0.21.3 is the newest release, so a version bump can't fix this. The tray-icon dev branch already sets cbSize at these call sites.

This PR:

  • Vendors tray-icon 0.21.3 unchanged under vendor/tray-icon and uses it through [patch.crates-io] in the root Cargo.toml. vendor/tray-icon is excluded from the workspace. Cargo.lock only loses tray-icon's registry source and checksum lines.
  • Patches src/platform_impl/windows/mod.rs in the vendored copy (vendor/tray-icon/PATCHED.md lists the changes):
    • every NOTIFYICONDATAW passed to Shell_NotifyIconW sets cbSize: size_of::<NOTIFYICONDATAW>() (icon set, tooltip set, add, remove);
    • the tooltip copy stops at 127 units instead of 128, so szTip always keeps its NUL.
  • Raises TRAY_TOOLTIP_MAX_UTF16 in tray_bridge.rs from 63 to 127. The test-only WIDE_BUDGET is removed, since the real budget is now 127. The legacy-limit test becomes fit_tooltip_keeps_two_typical_provider_lines_whole.

The vendored tree matches the crates.io package except for the patched file and PATCHED.md (git diff --no-index against the registry copy; Cargo's .cargo-ok and .cargo_vcs_info.json are omitted). Drop the vendored copy and the patch entry once a tray-icon release with the fix is usable by Tauri.

Commits:

  1. Vendor tray-icon 0.21.3 unchanged as a crates.io patch
  2. Set NOTIFYICONDATAW.cbSize in vendored tray-icon and use the full tooltip
  3. Merge main into fix/tray-icon-cbsize (a87fd43d0): main has the squashed Fit the tray tooltip into the 64-unit tip Windows actually shows #1007; the conflict in tray_bridge.rs keeps this branch's 127-unit budget and drops Fit the tray tooltip into the 64-unit tip Windows actually shows #1007's separate WIDE_BUDGET test constant, which is no longer needed.

Dependencies

The maintainer approved patching tray-icon as a follow-up PR to #1007. This PR adds no new crate. tray-icon 0.21.3 was already a dependency through Tauri, and the vendored vendor/tray-icon/Cargo.toml is the published crate's own manifest, unchanged. Cargo.lock keeps the same tray-icon version and dependency list. Only its registry source and checksum lines are removed, because the crate now resolves from the path patch.

Checks

  • cargo fmt --all -- --check: clean (the vendored crate is outside the workspace and isn't formatted).
  • cargo test --manifest-path apps/desktop-tauri/src-tauri/Cargo.toml: 814 passed, 0 failed on f51000e8d; 820 passed, 0 failed on the merge a87fd43d0.
  • cargo clippy --all-targets -- -D warnings on both manifests: clean on the merge.
  • pnpm notices:check: OK, 371 components (the vendored crate keeps its license files).
  • The shared rust/ crate is unchanged; CircleCI runs both manifests.

Proof

Windows 11, fresh debug build of this branch (head f51000e8d), isolated home, 5 seeded providers (CODEXBAR_SEED_USAGE_JSON), proof window on the second display. The tooltip was read through UI Automation (the tray icon's Name under Shell_TrayWnd) without taking focus. Explorer prefixes the name with "CodexBar Desktop " (17 units).

  • Before (Fit the tray tooltip into the 64-unit tip Windows actually shows #1007, 63-unit budget): CodexBar\nClaude: 58% left • Resets in 2h 50m….
  • After (127-unit budget): CodexBar\nClaude: 58% left • Resets in 1h 02m\nCodex: 82% left • Resets in 1h 02m\nCursor: 35% left • Resets in 1h 02m…. That's 116 units of tooltip text, past the old 64-unit cut, with whole lines and … marking the dropped lines.

Not covered

  • Tray icon pixels and the tray menu aren't affected and weren't re-proved.
  • The proof covers Windows 11 only.

@coderabbitai

coderabbitai Bot commented Oct 23, 2026 •

Copy link
Copy Markdown

Review in Change Stack →

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration
📥 Commits

Reviewing files that changed from the base of the PR and between 3b9d4ec and a87fd43.

⛔ Files ignored due to path filters: 2
  • Cargo.lock is excluded by !**/*.lock
  • vendor/tray-icon/Cargo.lock is excluded by !**/*.lock
📒 Files selected for processing: 22
  • Cargo.toml
  • apps/desktop-tauri/src-tauri/src/tray_bridge.rs
  • vendor/tray-icon/Cargo.toml
  • vendor/tray-icon/Cargo.toml.orig
  • vendor/tray-icon/LICENSE-APACHE
  • vendor/tray-icon/LICENSE-MIT
  • vendor/tray-icon/LICENSE.spdx
  • vendor/tray-icon/PATCHED.md
  • vendor/tray-icon/README.md
  • vendor/tray-icon/src/counter.rs
  • vendor/tray-icon/src/error.rs
  • vendor/tray-icon/src/icon.rs
  • vendor/tray-icon/src/lib.rs
  • vendor/tray-icon/src/platform_impl/gtk/icon.rs
  • vendor/tray-icon/src/platform_impl/gtk/mod.rs
  • vendor/tray-icon/src/platform_impl/macos/icon.rs
  • vendor/tray-icon/src/platform_impl/macos/mod.rs
  • vendor/tray-icon/src/platform_impl/mod.rs
  • vendor/tray-icon/src/platform_impl/windows/icon.rs
  • vendor/tray-icon/src/platform_impl/windows/mod.rs
  • vendor/tray-icon/src/platform_impl/windows/util.rs
  • vendor/tray-icon/src/tray_icon_id.rs

Included review availability: This review used your included allowance. Your plan provides up to 4 included reviews per hour; 0 remain after this review.

📝 Walkthrough

The workspace now resolves tray-icon from a vendored 0.21.3 copy. Its Windows implementation sets the shell structure size and supports 127 UTF-16 tooltip units. The desktop tooltip bridge uses that limit, and its fitting tests cover the updated behavior.

Changes: Vendored tray-icon and tooltip handling

Layer / File(s) Summary
Register and describe the vendored crate
Cargo.toml, vendor/tray-icon/Cargo.toml*, vendor/tray-icon/LICENSE-*, vendor/tray-icon/LICENSE.spdx, vendor/tray-icon/PATCHED.md, vendor/tray-icon/README.md
The workspace excludes vendor/tray-icon from membership and patches the crates.io dependency to use the vendored version. The package manifests, licenses, patch notes, and crate documentation are added.
Add tray-icon API and shared types
vendor/tray-icon/src/lib.rs, vendor/tray-icon/src/counter.rs, vendor/tray-icon/src/error.rs, vendor/tray-icon/src/icon.rs, vendor/tray-icon/src/tray_icon_id.rs, vendor/tray-icon/src/platform_impl/mod.rs
The crate adds its builder and tray-icon APIs, identifiers, icon validation, event types and delivery, shared errors, and platform selection.
Implement the GTK tray backend
vendor/tray-icon/src/platform_impl/gtk/*
The GTK backend creates and updates indicators, writes icon files, and selects an icon directory. A test checks directory selection.
Implement the macOS tray backend
vendor/tray-icon/src/platform_impl/macos/*
The macOS backend manages status items, icons, menus, and visibility. It tracks mouse interactions and dispatches tray events with cursor and icon geometry.
Implement Windows tray registration and events
vendor/tray-icon/src/platform_impl/windows/*
The Windows backend creates a tray window, registers the icon, handles taskbar restarts and mouse events, and manages icon resources. Shell registration uses a 127-unit tooltip limit.
Update the desktop tooltip limit and tests
apps/desktop-tauri/src-tauri/src/tray_bridge.rs
The tooltip limit increases from 63 to 127 UTF-16 units. Fitting tests use the shared limit and expect both typical provider lines to remain intact.

Priority: ⬇️ Low

Estimated code review effort: 4 (Complex) | ~45 minutes

Change: Bug fix

Possibly related PRs

  • nesszer/Win-CodexBar#1007: Sets the earlier 63-unit tooltip cap and adds tooltip line-fitting logic that this change updates.
Merge Risk: ⚪ Minimal · up to a87fd

This change vendors tray-icon with a Windows fix so the tray tooltip can show more provider information. No concrete merge-blocking issue remains. The Windows 11 behavior rests on the author's reported proof.

Caution

Pre-merge checks failed

Please resolve all errors before merging. Addressing warnings is optional.

  • Ignore

Failed Failed checks: 1 error

Check name Status Explanation Resolution
No Unapproved Dependencies Error The PR adds dependency declarations in the new vendor/tray-icon/Cargo.toml, including runtime, target-specific, and development dependencies at lines 51-96 and later sections. The supplied PR descri… Obtain maintainer approval for the vendored manifest dependency additions and record that approval in the PR description. Otherwise remove the unapproved dependency declarations and the vendored dependency addition.
Passed Passed checks: 7 passed
Check name Status Explanation
Description Check Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check Passed The title clearly and accurately summarizes the main change: vendoring tray-icon, correcting cbSize, and expanding the Windows tray tooltip to 127 units. It uses a short imperative summary.
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.
Provider Data Stays Siloed Passed The changed tray code only raises the shared tooltip limit from 63 to 127 UTF-16 units and updates vendored Windows tray-icon buffer handling. The diff adds no provider-specific identity, plan, acco…
Secrets Handled Safely Passed No changed code exposes credentials. The tray tooltip contains provider labels, usage metrics, fixed incident labels, or provider errors that enter the snapshot through safe_error_message, which app…
Ui Changes Include Windows Proof Passed The PR changes the visible Windows tray tooltip: TRAY_TOOLTIP_MAX_UTF16 increases from 63 to 127, and vendored tray-icon sets NOTIFYICONDATAW.cbSize while copying the tooltip. The PR description…
Full details: Provider Data Stays Siloed

Explanation

The changed tray code only raises the shared tooltip limit from 63 to 127 UTF-16 units and updates vendored Windows tray-icon buffer handling. The diff adds no provider-specific identity, plan, account-label, or email routing, logging, persistence, or payload transfer. Existing tooltip construction keeps each status line labeled with its own snapshot's display_name; the added capacity does not assign data across providers or accounts. No new ProviderId matching was added outside the allowed paths.

Full details: Secrets Handled Safely

Explanation

No changed code exposes credentials. The tray tooltip contains provider labels, usage metrics, fixed incident labels, or provider errors that enter the snapshot through safe_error_message, which applies SecretRedactor. The vendored tray code logs only a static icon-removal message; its file operations create and remove PNG icon files, not credential files. No changed tests, snapshots, or plain-text files contain credentials.

Full details: Ui Changes Include Windows Proof

Explanation

The PR changes the visible Windows tray tooltip: TRAY_TOOLTIP_MAX_UTF16 increases from 63 to 127, and vendored tray-icon sets NOTIFYICONDATAW.cbSize while copying the tooltip. The PR description includes a fresh Windows 11 build proof note with UI Automation results and before/after tooltip text.

Full details: No Unapproved Dependencies

Explanation

The PR adds dependency declarations in the new vendor/tray-icon/Cargo.toml, including runtime, target-specific, and development dependencies at lines 51-96 and later sections. The supplied PR description explains the vendoring and Cargo patch, but does not state that a maintainer approved these additions. No package.json, npm/yarn lockfile, or pnpm version change was found.

Resolution

Obtain maintainer approval for the vendored manifest dependency additions and record that approval in the PR description. Otherwise remove the unapproved dependency declarations and the vendored dependency addition.

✨ Finishing Touches
📝 Generate docstrings
  • Commit to this branch
  • Create a new PR
🧪 Generate unit tests (beta)
  • Commit to this branch
  • Create a new PR
  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@Finesssee

Copy link
Copy Markdown
Collaborator Author

@coderabbitai review

@coderabbitai

coderabbitai Bot commented Oct 23, 2026 •

Copy link
Copy Markdown
⚠️ Action not completed

Review rate limited.

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.

@Finesssee

Copy link
Copy Markdown
Collaborator Author

@coderabbitai review

@coderabbitai

coderabbitai Bot commented Oct 24, 2026 •

Copy link
Copy Markdown
⚠️ Action not completed

Review rate limited.

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.

@Finesssee

Copy link
Copy Markdown
Collaborator Author

@coderabbitai review

@coderabbitai

coderabbitai Bot commented Oct 24, 2026 •

Copy link
Copy Markdown
✅ 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.

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Pre-merge checks failed. Please resolve the failing checks before merging.

@Finesssee

Copy link
Copy Markdown
Collaborator Author

@coderabbitai On the "No Unapproved Dependencies" pre-merge check: the maintainer approved patching tray-icon as a follow-up PR to #1007, and the PR description now records that under "Dependencies". The PR adds no new crate. tray-icon 0.21.3 was already in the graph through Tauri. vendor/tray-icon/Cargo.toml is the published crate's own manifest, unchanged, so its dependency declarations are the ones already resolved. In Cargo.lock, tray-icon keeps the same version and dependency list. Only its registry source and checksum lines are removed, because it now resolves from the [patch.crates-io] path.

@coderabbitai

coderabbitai Bot commented Oct 24, 2026

Copy link
Copy Markdown

Tip

For best results, initiate chat on the files or code changes.

🧩 Analysis chain

🏁 Script executed:

#!/bin/bash
set -euo pipefail
gh pr view 1015 --repo nesszer/Win-CodexBar --json body,baseRefOid,headRefOid
gh api repos/nesszer/Win-CodexBar/pulls/1015/files --paginate --jq '.[] | select(.filename == "Cargo.toml" or .filename == "Cargo.lock" or .filename == "vendor/tray-icon/Cargo.toml") | {filename,status,patch}'
ast-grep outline vendor/tray-icon/Cargo.toml || true
sed -n '1,200p' vendor/tray-icon/Cargo.toml
rg -n -A28 -B2 '^name = "tray-icon"$' Cargo.lock

Length of output: 13808


@Finesssee The “No Unapproved Dependencies” check should pass for this change under the existing policy.

I verified that:

  • The PR description’s Dependencies section records maintainer approval.
  • Cargo.toml patches the existing tray-icon crate to the vendored path.
  • Cargo.lock keeps version 0.21.3 and the same dependency list. Its only changes remove the registry source and checksum lines.

The existing dependency-policy Learning already permits changes with maintainer approval recorded in the PR description. No policy exception is needed.

This is my assessment of that check, not confirmation that its recorded status has changed.


🧠 Learnings used
Learnt from: CR
Repo: nesszer/Win-CodexBar PR: 0
File: coderabbit-custom-pre-merge-checks-unique-id-file-non-traceable-F7F2B60C-1728-4C9A-8889-4F2235E186CA.txt:0-0
Timestamp: 2026-10-22T21:31:24.965Z
Learning: Applies to Cargo.toml : No unapproved dependencies: Fail if the change adds a dependency to any Cargo.toml or package.json, adds an npm or yarn lockfile, or changes the pinned pnpm packageManager version, unless the PR description says a maintainer approved that addition. Version bumps of existing dependencies only warn. Pass otherwise.

You are interacting with an AI system.

@Finesssee
Finesssee merged commit 77b98fa into main Oct 24, 2026
4 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant