Skip to content

feat(desktop-gpui): make centring an option under Focus mode, and explain what Focus records - #3511

Merged
richiemcilroy merged 8 commits into
mainfrom
feat/gpui-focus-center-option
Oct 28, 2026
Merged

richiemcilroy merged 8 commits into
mainfrom
feat/gpui-focus-center-option

Conversation

@richiemcilroy

@richiemcilroy richiemcilroy commented Oct 28, 2026 •

Copy link
Copy Markdown
Member

Summary

Turning on Focus mode in the window picker used to also move the picked window to the middle of the screen. Centring is now a separate option, off by default, and the card explains what Focus records.

  • Focus mode records only the picked window and leaves it where it is. Its card now says so: "Only what's inside this window is recorded. Other windows, even ones on top of it, and the rest of your screen stay out of the video." That line shows under the card while Focus is on, not only in the hover hint.
  • Center on screen appears under Focus while it is on. Turning it on moves the window to the middle of its screen now and on every later pick; turning it off puts the window back where the picker found it. It is saved as focusCenter in the general settings, so it carries over to the next time you pick a window.
  • Focus mode only shows on macOS and Windows, the two platforms that can record a window by itself. A stored Focus choice no longer applies on Linux.
  • The card is a fixed 300 pt wide, and its text wraps instead of pushing the switches past the edge.
  • No hint covers the Start button any more: the button registers as keep-clear, and hint placement skips any side whose bubble or arrow would overlap it. The Focus card's hint, which used to open below the card on top of the button, now sits above it.

Test plan

  • Picker probe on the Mac mini (macOS 27): Focus without centring leaves the window where it was; Center on screen centres it; turning Focus off and dismissing the picker both put it back
  • Focus card with both switches renders inside the card on the Mac mini
  • Hovering the Focus card puts its hint above the card, clear of the Start button (Mac mini); new never_covers_a_kept_clear_control test plus the existing hint tests pass
  • Picker smoke in CI on macOS, Windows and Linux

RetriggerView in GreptileConfidence Score: 5/5

The PR appears safe to merge, with both previous findings addressed and no new blocking issues found.

Summary

Focus and centring are now separate choices, with centring saved in focusCenter.

  • Focus records the picked window without moving it unless centering is on.
  • Picker hints avoid covering the Start button.
  • The picker’s close button stands out with red-tinted glass.

Reviews (3) · Last reviewed commit: "chore(desktop-gpui): drop the set_focus ..." · Reviewed by Greptile

…-in Center on screen, and explains what it records
@vercel

vercel Bot commented Oct 28, 2026 •

Copy link
Copy Markdown
Contributor

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated
cap-status Ready Ready Preview Oct 28, 2026 2:14pm UTC

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

Capy found no issues.

View 1 other finding in Capy.

Open in Capy

Comment thread apps/desktop-gpui/src/picker_probe.rs Outdated
Comment on lines +236 to +237
view.set_focus_center(false, cx);
view.set_focus(true, cx)

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

P2 Saved Focus causes false failures

If Focus was already saved as on, set_focus_center(false) restores the window's original bounds after choose_window_size resizes it. The probe then compares those restored bounds with shaped and reports a failure even though Focus behaves correctly. Set Focus off before resizing so this check starts from a known state.

Prompt To Fix With AI
This is a comment left during a code review.
Path: apps/desktop-gpui/src/picker_probe.rs
Line: 236-237

Comment:
**Saved Focus causes false failures**

If Focus was already saved as on, `set_focus_center(false)` restores the window's original bounds after `choose_window_size` resizes it. The probe then compares those restored bounds with `shaped` and reports a failure even though Focus behaves correctly. Set Focus off before resizing so this check starts from a known state.

---

For each issue above, determine whether it is valid and should be fixed. If so, fix it directly.

Comment thread apps/desktop-gpui/src/target_overlay.rs Outdated
Comment on lines +2562 to +2563
/// Center on screen, under Focus: centre the picked window now (and on
/// every later pick), or put it back where the picker found it.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

P2 Comments repeat the code

The new set_focus_center comment only narrates what the method does. AGENTS.md requires comments to explain non-obvious context and explicitly bans comments that describe the current change. Remove this comment and the same kind of new comment on focus_center in store.rs; the pattern also appears in the updated set_focus comment. This repository requirement must be satisfied before merging.

Context Used: AGENTS.md (source)

Prompt To Fix With AI
This is a comment left during a code review.
Path: apps/desktop-gpui/src/target_overlay.rs
Line: 2562-2563

Comment:
**Comments repeat the code**

The new `set_focus_center` comment only narrates what the method does. `AGENTS.md` requires comments to explain non-obvious context and explicitly bans comments that describe the current change. Remove this comment and the same kind of new comment on `focus_center` in `store.rs`; the pattern also appears in the updated `set_focus` comment. This repository requirement must be satisfied before merging.

**Context Used:** AGENTS.md ([source](https://github.com/capsoftware/cap/blob/main/AGENTS.md))

---

For each issue above, determine whether it is valid and should be fixed. If so, fix it directly.

Note: If this suggestion doesn't match your team's coding style, reply to this and let me know. I'll remember it for next time!

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

Capy found no issues.

Open in Capy

@richiemcilroy

Copy link
Copy Markdown
Member Author

@greptileai addressed in 5663976: the probe starts from Focus off, and the narrating comments are gone. Please re-review.

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

Capy found no issues.

View 3 other findings in Capy.

Open in Capy

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

Capy found no issues.

Open in Capy

@richiemcilroy

Copy link
Copy Markdown
Member Author

@greptileai the set_focus_center and focus_center comments went in 5663976 and the set_focus one in e750cc8; please re-review.

@richiemcilroy
richiemcilroy merged commit cb2dd76 into main Oct 28, 2026
65 checks passed

This branch was successfully deployed

2 active deployments
Preview – cap-web — e750cc89 Deployed Oct 28, 2026 by vercel[bot]
Preview – cap-status — e750cc89 Deployed Oct 28, 2026 by vercel[bot]
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