Skip to content

fix(panel): clamp panel to visible screen when menu bar auto-hides#557

Open
westline-marketing wants to merge 1 commit into
robinebers:mainfrom
westline-marketing:fix/clamp-panel-when-menu-bar-auto-hidden
Open

fix(panel): clamp panel to visible screen when menu bar auto-hides#557
westline-marketing wants to merge 1 commit into
robinebers:mainfrom
westline-marketing:fix/clamp-panel-when-menu-bar-auto-hidden

Conversation

@westline-marketing
Copy link
Copy Markdown

@westline-marketing westline-marketing commented Jun 4, 2026

Fixes #556

Root cause

position_panel_at_tray_icon anchors the panel's top edge to the bottom of the tray icon rect. When the macOS menu bar is set to auto-hide and is currently hidden, the bar — and the status item in it — sits above the visible screen, so tray.rect() reports a rect above the monitor's top edge. The computed panel_y lands off-screen and nothing clamps it, so the panel header renders clipped above the screen top.

Fix

Clamp the panel's top edge to the monitor's top edge (one line, plus comment). Behavior with a visible menu bar is unchanged: the anchor already lands below the bar in that case, so the clamp never engages.

Testing

  • Built and ran the patched bundle on macOS 26.5 (Tahoe), Mac Studio (Apple Silicon), OpenUsage 0.6.26 base
  • Menu bar auto-hide ON, bar hidden, panel opened via global shortcut: panel now pins fully visible at the top edge (previously clipped — before screenshot in Panel is clipped at the top of the screen when the macOS menu bar is set to auto-hide #556)
  • Menu bar visible: panel position identical to current behavior
  • bun run build and bun run test pass (64 files, 1090 tests)

🤖 Generated with Claude Code


Summary by cubic

Clamp the panel’s top edge to the monitor top when the macOS menu bar auto-hides, so the panel stays fully visible instead of clipping off-screen. Behavior is unchanged when the menu bar is visible.

Written for commit d4c4f45. Summary will update on new commits.

Review in cubic

Summary by CodeRabbit

Bug Fixes

  • Fixed a macOS-specific issue where the panel could be positioned off-screen when the system menu bar auto-hides, causing the tray icon location to shift. The panel position is now automatically adjusted to remain within the monitor's visible boundaries.

When the macOS menu bar is set to auto-hide, the tray icon rect sits
above the visible screen, so the panel anchored to its bottom edge
rendered partially off-screen with the header clipped. Clamp the
panel's top edge to the monitor's top edge. Behavior with a visible
menu bar is unchanged, since the anchor already lands below the bar.

Fixes robinebers#556

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
@github-actions github-actions Bot added the rust Pull requests that update rust code label Jun 4, 2026
@coderabbitai
Copy link
Copy Markdown

coderabbitai Bot commented Jun 4, 2026

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 Plus

Run ID: bc71e306-e54c-4750-ad1c-d39c187b6ae5

📥 Commits

Reviewing files that changed from the base of the PR and between 8a5b337 and d4c4f45.

📒 Files selected for processing (1)
  • src-tauri/src/panel.rs

📝 Walkthrough

Walkthrough

The PR fixes a bug where the panel is clipped at the top of the screen when the macOS menu bar is set to auto-hide. The position_panel_at_tray_icon function in panel.rs now clamps the computed panel Y position to the monitor's top edge, preventing off-screen positioning when the tray icon rect appears above the visible area.

Changes

Panel Y Position Clamping

Layer / File(s) Summary
Panel Y position clamping
src-tauri/src/panel.rs
The panel Y position calculation clamps to the monitor's logical top edge using max(mon_logical_y) to keep the panel fully visible when the macOS menu bar auto-hides and the tray icon position moves above the visible screen boundary.

🎯 2 (Simple) | ⏱️ ~8 minutes

🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 0.00% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (4 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title accurately summarizes the main change: clamping the panel to the visible screen when the macOS menu bar auto-hides, which is the core fix in the changeset.
Linked Issues check ✅ Passed The code changes directly implement the proposed solution from issue #556 by clamping panel_y to the monitor's logical top edge using .max(mon_logical_y), fully addressing the reported panel clipping issue.
Out of Scope Changes check ✅ Passed The four-line change is narrowly focused on the specific panel positioning issue and does not introduce any unrelated modifications.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests

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

Copy link
Copy Markdown
Contributor

@cubic-dev-ai cubic-dev-ai Bot left a comment

Choose a reason for hiding this comment

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

No issues found across 1 file

Re-trigger cubic

@validatedev
Copy link
Copy Markdown
Collaborator

@codex review

@chatgpt-codex-connector
Copy link
Copy Markdown

Codex Review: Didn't find any major issues. 🚀

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

rust Pull requests that update rust code

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Panel is clipped at the top of the screen when the macOS menu bar is set to auto-hide

2 participants