Skip to content

fix(menubar): realign tray icon geometry#49

Merged
BlackHole1 merged 2 commits into
mainfrom
fix/menubar-tray-icon-geometry
Jul 1, 2026
Merged

fix(menubar): realign tray icon geometry#49
BlackHole1 merged 2 commits into
mainfrom
fix/menubar-tray-icon-geometry

Conversation

@BlackHole1

Copy link
Copy Markdown
Member

LockIME's previous tray glyph used a keyboard with an external lock badge, which made the icon sit lower than neighboring macOS menu bar items. This replaces the composition with a centered keyhole panel: locked and unlocked now share the same frame and differ only in the keyhole fill, so state changes keep the same optical alignment.

The tray icon generator now writes directly into the asset catalog and regenerates the template PNGs from that source of truth.

Closes #47

The old tray glyph placed a lock badge outside the keyboard shape, which
pulled the optical center low in the macOS menu bar. Replace it with a
centered keyhole panel so both states share the same frame and alignment.

Update the generator to write directly into the asset catalog and
regenerate the template PNGs from that source of truth.

Closes #47

Signed-off-by: Kevin Cui <bh@bugs.cc>
@coderabbitai

coderabbitai Bot commented Jul 1, 2026

Copy link
Copy Markdown

Review Change Stack

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

Run ID: 3e001cef-679f-4e26-8286-5e317af35eef

📥 Commits

Reviewing files that changed from the base of the PR and between 6f7b6d7 and 1d833c7.

📒 Files selected for processing (1)
  • scripts/icon-tools/MakeTrayIcon.swift
🚧 Files skipped from review as they are similar to previous changes (1)
  • scripts/icon-tools/MakeTrayIcon.swift

Summary by CodeRabbit

  • New Features
    • Updated the app’s tray/menu-bar icon design to a cleaner centered style, using a keyhole-based glyph for clearer locked versus unlocked states.
    • Improved visual consistency by switching to centered monochrome template glyphs so the system can automatically apply the correct light/dark/active menu-bar tint.
    • Enhances legibility across theme and interaction states.

Walkthrough

This change updates the menu bar app comment to describe centered template glyph tinting, and rewrites the tray icon generator to render a centered rounded panel with a keyhole glyph for locked and unlocked states. The script now maps outputs to TrayLocked.imageset and TrayUnlocked.imageset when those directories exist, otherwise writing to the provided output directory, and it reports write failures explicitly. No exported or public API declarations changed.

Related issues: #47 — the icon composition was changed to improve menu bar alignment.

Suggested labels: enhancement, design

Suggested reviewers: none identified

🚥 Pre-merge checks | ✅ 4
✅ Passed checks (4 passed)
Check name Status Explanation
Title check ✅ Passed The title uses the required type(scope): subject format and accurately summarizes the tray icon geometry change.
Description check ✅ Passed The description matches the tray icon alignment and asset-generation changes in the PR.
Linked Issues check ✅ Passed The icon composition now centers the glyph and uses an integrated keyhole panel, matching the requested optical-center alignment improvement.
Out of Scope Changes check ✅ Passed The changes stay focused on tray icon geometry and generator output, with no unrelated feature work.
✨ Finishing Touches
✨ Simplify code
  • Create PR with simplified code
  • Commit simplified code in branch fix/menubar-tray-icon-geometry

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

@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.

Actionable comments posted: 1

🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Inline comments:
In `@scripts/icon-tools/MakeTrayIcon.swift`:
- Around line 133-142: The write step in MakeTrayIcon’s state/scale loop is
swallowing failures via try?, which can incorrectly print a success message
after a failed output write. Update the png.write(to:) call to handle the thrown
error explicitly in this generator flow, and log the failure to stderr using the
same print-based error reporting pattern used by the other icon-tools CLI code
(for example, by referencing outputURL(for:scale:) and the existing “wrote” log
path). Only emit the success message after a successful write, so a missing
directory or permission error is surfaced instead of discarded.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

Run ID: 24706263-ce6e-4a03-9a51-7509e97ba133

📥 Commits

Reviewing files that changed from the base of the PR and between a28c33e and 6f7b6d7.

⛔ Files ignored due to path filters (4)
  • Sources/LockIME/Assets.xcassets/TrayLocked.imageset/tray-locked.png is excluded by !**/*.png
  • Sources/LockIME/Assets.xcassets/TrayLocked.imageset/tray-locked@2x.png is excluded by !**/*.png
  • Sources/LockIME/Assets.xcassets/TrayUnlocked.imageset/tray-unlocked.png is excluded by !**/*.png
  • Sources/LockIME/Assets.xcassets/TrayUnlocked.imageset/tray-unlocked@2x.png is excluded by !**/*.png
📒 Files selected for processing (2)
  • Sources/LockIME/LockIMEApp.swift
  • scripts/icon-tools/MakeTrayIcon.swift

Comment thread scripts/icon-tools/MakeTrayIcon.swift
Signed-off-by: Kevin Cui <bh@bugs.cc>
@BlackHole1 BlackHole1 merged commit 1cd8c39 into main Jul 1, 2026
3 checks passed
@BlackHole1 BlackHole1 deleted the fix/menubar-tray-icon-geometry branch July 1, 2026 10:03
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.

Feature Request: Menu Bar Icon Alignment

1 participant