Skip to content

Let a header put the traffic lights further in - #40

Open
igor-alexandrov wants to merge 1 commit into
crmne:mainfrom
igor-alexandrov:titlebar-traffic-light-inset
Open

igor-alexandrov wants to merge 1 commit into
crmne:mainfrom
igor-alexandrov:titlebar-traffic-light-inset

Conversation

@igor-alexandrov

@igor-alexandrov igor-alexandrov commented Oct 21, 2026 •

Copy link
Copy Markdown
Contributor

User-visible UI impact: none. Existing callers of align_traffic_lights keep the 16-point inset.

Why

Hindsight runs its content under the hidden title bar and puts the traffic lights at the start of a 52-point unified toolbar, with the close button 20 points in to match its toolbar padding. align_traffic_lights fixes that edge at 16, so Hindsight carries a copy of the AppKit alignment in its own code that changes only that one number. Calling both is not an option: each would move the buttons back every frame.

What

  • align_traffic_lights_at(frame, ctx, header_height, left): the same alignment, with the close button left AppKit points in. The buttons stay 20 points apart and left does not scale with zoom.
  • align_traffic_lights now calls it with 16, so its behaviour is unchanged.
  • footprint still reports TRAFFIC_LIGHTS_WIDTH (84); the docs say a header that moves the buttons in leaves the extra room itself.
  • A test for the new inset next to the existing column test; the crate README and docs mention the new function.

If you would rather not add a public function, a left field somewhere you prefer works just as well for Hindsight.

Checks

On Linux: cargo fmt --all --check, cargo clippy --locked -p fastframe-titlebar --all-targets -- -D warnings, cargo test --locked -p fastframe-titlebar --all-targets, and RUSTDOCFLAGS='-D warnings' cargo doc -p fastframe-titlebar --no-deps. For macOS, cargo check and cargo clippy -- -D warnings with --target aarch64-apple-darwin, type-checked from Linux only. Not run on a Mac.

Summary by CodeRabbit

  • New Features
    • Added an option to customize the horizontal position of macOS traffic-light buttons in the title bar.
    • Existing alignment behavior remains available with the default positioning.
    • Custom positioning is ignored on non-macOS platforms.
  • Documentation
    • Documented the alignment option and clarified that reported title-bar footprint includes the space needed for the aligned buttons.

@coderabbitai

coderabbitai Bot commented Oct 21, 2026 •

Copy link
Copy Markdown

Explain Change →

No actionable comments were generated in the recent review.

Walkthrough

The title-bar crate now exposes align_traffic_lights_at, which accepts a custom horizontal offset for macOS traffic lights. The existing alignment function uses the default offset. Tests cover default and custom positioning.

Changes: Traffic-Light Alignment

Layer / File(s) Summary
Add configurable traffic-light alignment
crates/fastframe-titlebar/src/macos.rs, crates/fastframe-titlebar/src/macos/appkit.rs, crates/fastframe-titlebar/src/lib.rs, crates/fastframe-titlebar/README.md
The public align_traffic_lights_at function accepts a custom left offset and passes it to AppKit positioning. The existing alignment function delegates using the default offset. Tests check a 20-point custom offset and button spacing. Documentation describes the offset and states that footprint measures the aligned button positions, including additional room.

Estimated code review effort: 2 (Simple) | ~10 minutes

Change: Feature

Suggested reviewers: crmne

Merge Risk: Minimal · up to a17a5

This adds an opt-in alignment function with a custom inset, and existing callers keep the default 16-point behavior. No concrete merge-blocking risk was found. The macOS path was only type-checked from Linux, which is normal for this change.

Pre-merge checks: Passed 6

Check name Status Explanation
Description Check Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check Passed The title "Let a header put the traffic lights further in" matches the main change: a new align_traffic_lights_at function lets a header set a custom inset for the macOS traffic lights, moving them fu…
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.
Review Evidence Stays Out Of The Repository Passed The changed-file inventory for refs/coderabbit/pre-merge-check/base..head lists four modified files and no added files: crates/fastframe-titlebar/README.md, src/lib.rs, src/macos.rs, and src/macos/app…
Dependencies From Sources The Maintainer Controls Passed The check fails only when the PR changes a dependency source in a manifest, lockfile, or package manager configuration to something other than the package registry or a github.com/crmne/ or same-organ…
Full details: Title check

Explanation

The title "Let a header put the traffic lights further in" matches the main change: a new align_traffic_lights_at function lets a header set a custom inset for the macOS traffic lights, moving them further in than the default 16 points. It is specific and descriptive, though it is written from the header's perspective and does not name the new public API.

Full details: Review Evidence Stays Out Of The Repository

Explanation

The changed-file inventory for refs/coderabbit/pre-merge-check/base..head lists four modified files and no added files: crates/fastframe-titlebar/README.md, src/lib.rs, src/macos.rs, and src/macos/appkit.rs. The diff stat shows 66 insertions and 25 deletions in source and docs only. No screenshots, captures, recordings, before-and-after folders, or HTML comparison pages were added. The PR description carries no media either. The check does not apply to any review-evidence artifacts, so it passes.

Full details: Dependencies From Sources The Maintainer Controls

Explanation

The check fails only when the PR changes a dependency source in a manifest, lockfile, or package manager configuration to something other than the package registry or a github.com/crmne/ or same-organization repository. Evidence: - The changed-file inventory (git diff --name-status) lists four files, all modified (M): crates/fastframe-titlebar/README.md, crates/fastframe-titlebar/src/lib.rs, crates/fastframe-titlebar/src/macos.rs, and crates/fastframe-titlebar/src/macos/appkit.rs. - None of these is a manifest, lockfile, or config file. No Cargo.toml, Cargo.lock, .cargo/config*, rust-toolchain*, or deny.toml appears in the diff. - A search of the added lines for git =, registry, [patch, [replace, source =, URLs, and extern crate found no dependency-source change. The only hit was a pub use macos::{...} re-export in lib.rs, which is an internal module re-export, not a dependency. The PR does not add or alter any dependency source, so the failure condition does not apply.

Finishing Touches

Generate unit tests (beta)

  • 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

Recent review info

Run configuration

Commits

Reviewing files that changed from the base of the PR and between ac8eaa7 and a17a5ff.

Files selected for processing: 3

  • crates/fastframe-titlebar/README.md
  • crates/fastframe-titlebar/src/macos.rs
  • crates/fastframe-titlebar/src/macos/appkit.rs

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

@crmne

crmne commented Nov 19, 2026

Copy link
Copy Markdown
Owner

Thanks, and sorry for the wait. I merged #34 first, which reads the spacing AppKit gives the buttons (23 points from macOS 26) and measures the header's room from the zoom button's right edge. That conflicts with this one, but it also means a left inset would get the right footprint for free.

Happy to take align_traffic_lights_at once it's rebased on main: keep AppKit's spacing rather than the fixed 20, and drop the note that the header leaves the extra room itself, since footprint will follow the buttons. Main is also on egui 0.37 now.

align_traffic_lights_at takes the close button's left edge in AppKit
points; align_traffic_lights keeps the usual 16. Hindsight's toolbar
puts the buttons 20 points in and carries its own copy of the AppKit
alignment only to change that one number.
@igor-alexandrov
igor-alexandrov force-pushed the titlebar-traffic-light-inset branch from ac8eaa7 to a17a5ff Compare November 19, 2026 19:48
@chat-with-work
chat-with-work Bot requested a review from crmne November 19, 2026 19:48
@chat-with-work

Copy link
Copy Markdown

@coderabbitai review

This branch has not been deployed

No deployments
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.

2 participants