Skip to content

Add focus-stage extension - #33919

Merged
raycastbot merged 11 commits into
raycast:mainfrom
mirkopoloni:ext/focus-stage
Nov 27, 2026
Merged

raycastbot merged 11 commits into
raycast:mainfrom
mirkopoloni:ext/focus-stage

Conversation

@mirkopoloni

@mirkopoloni mirkopoloni commented Nov 24, 2026 •

Copy link
Copy Markdown
Contributor

Description

Focus Stage puts one window on stage: Toggle Focus Stage centers the focused window, covers everything else on every display with a plain backdrop (light or dark, optional grain, a soft accent-colored glow around the window, a small "Focus Stage on" label), auto-hides the menu bar and the Dock and, optionally, holds notification banners until the session ends. Running it again restores everything exactly as it was. Nothing is hidden or quit: the backdrop only covers other windows, so the desktop comes back unchanged.

Commands:

  • Toggle Focus Stage (no-view): starts or ends a session.
  • Reset Focus Stage (no-view): ends any session, even a stuck one, and restores the window, the menu bar, the Dock and notifications from a small recovery record.
  • Focus Stage Menu Bar: shows whether a session is on, with Start/End and Settings.

Full-screen windows are handled (their display is left alone, the others are covered), as are several displays and other apps in full screen on other displays.

How it's built

The extension uses Raycast's Swift support (raycast/extensions-swift-tools); all native code is in swift/ and compiled by ray build, no prebuilt binaries. A session needs a process that stays alive (one borderless panel per display, Accessibility observers for the focused window), so toggleStage starts the same compiled Swift binary as a detached helper and talks to it through a state file in environment.supportPath. The helper exits when the session ends; SIGTERM makes it restore everything first. It inherits Raycast as its responsible process, so it uses Raycast's Accessibility permission.

Things I'd like your opinion on

  1. Holding notifications. macOS has no public API for Do Not Disturb or Focus modes. The optional "Hold notifications until focus ends" preference (off by default) sends SIGSTOP to the user's own NotificationCenter process at the start and SIGCONT at the end. Notifications are still delivered and kept; the banners appear when the session ends. It's resumed on every new session and by Reset Focus Stage, and the README explains it and how to undo it by hand. I think it's an important part of the extension, but it pauses a system process, so please tell me if this is acceptable for the Store or if you'd prefer it removed.
  2. Private API. The window ID comes from _AXUIElementGetWindow (looked up with dlsym, with a fallback that matches window frames), the same function Rectangle, yabai and AltTab use.
  3. System settings. "Automatically hide and show the menu bar" and (a preference, on by default) "Automatically hide and show the Dock" are switched on through System Events for the session (one Automation prompt) and switched back off afterwards, each only if the extension turned it on.
  4. Background helper. See above; it only runs while a session is on.

Screencast

No screencast; the screenshots in metadata/ show a session.

Checklist

  • I read the extension guidelines
  • I read the documentation about publishing
  • I ran npm run build and tested this distribution build in Raycast
  • I checked that files in the assets folder are used by the extension itself
  • I checked that assets used by the README are placed outside of the metadata folder

- Icon: full-size window with a cool-grey outline
- Extension icon fills its canvas edge to edge
- Icon: pastel periwinkle tile
- Icon: pastel sage tile
- Icon: window centered on a neutral grey tile
- Test the full-window icon; colour menu bar icons
- Menu bar icons from the new icon; rename the extension icon
- New icon: relieved face in a window, designed in Paper
- Store screenshots: real sessions in Zed with a sample project
- Keep the backdrop in place when the app reorders its windows; end on quit while starting
- Hide the Dock during a session (on by default)
- Rename label to "Focus Stage on", lead the description with what it does
- Initial commit: Focus Stage
@raycastbot raycastbot added new extension Label for PRs with new extensions platform: macOS labels Nov 24, 2026
@raycastbot

Copy link
Copy Markdown
Collaborator

Congratulations on your new Raycast extension! 🚀

We're currently experiencing a high volume of incoming requests. As a result, the initial review may take up to 15 business days.

Once the PR is approved and merged, the extension will be available on our Store.

@greptile-apps

greptile-apps Bot commented Nov 24, 2026 •

Copy link
Copy Markdown
Contributor

Confidence Score: 5/5 · No blocking issue remains within this follow-up review’s scope.RetriggerView in GreptileConfidence Score: 5/5

[Medium impact] No blocking issue remains within this follow-up review’s scope.

Summary

Adds Focus Stage commands to center a window, cover other windows, and restore desktop settings when the session ends.

  • A focused window gets a backdrop stage that follows it.
  • Sessions restore the window and settings they changed.
  • Notification banners can wait until a focus session ends.
  • Raycast commands and a menu bar item control each stage.

Reviews (11) · Last reviewed commit: "Update CHANGELOG.md and optimise images" · Reviewed by Greptile

Comment thread extensions/focus-stage/package.json Resolved
Comment thread extensions/focus-stage/README.md Resolved
@mirkopoloni
mirkopoloni marked this pull request as ready for review November 24, 2026 17:52

@0xdhrv 0xdhrv left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Hey @mirkopoloni 👋

Thanks for Focus Stage, the recovery record behind Reset Focus Stage and the way you worked through the Greptile findings are really well thought out 🔥

Here's everything I found in this pass:

Should fix

  • src/focus-stage-menu-bar.tsx:24 and :26: showFailureToast is called from the menu bar item's onAction. Menu bar commands run in the background, where the Toast API isn't available, so when starting or ending a session fails, users would see an error instead of your message. Please use showHUD for these two messages. The toasts in toggle-focus-stage.ts and reset-focus-stage.ts are fine, since those are no-view commands.

    if (outcome.error) await showHUD(`Focus Stage didn't start: ${outcome.error}`);

Feel free to reach me here or on Slack if anything is unclear.

@0xdhrv
0xdhrv marked this pull request as draft November 27, 2026 05:00
@0xdhrv 0xdhrv self-assigned this Nov 27, 2026
@mirkopoloni

Copy link
Copy Markdown
Contributor Author

Thanks @0xdhrv for your review!
Fixed in 3ad05a7: both messages in the menu bar command's Start/End Focus handler now use showHUD ("Focus Stage didn't start: …" and "Focus Stage failed: …"). The toasts in Toggle Focus Stage and Reset Focus Stage are unchanged, since those are no-view commands.

@mirkopoloni
mirkopoloni marked this pull request as ready for review November 27, 2026 11:24

@0xdhrv 0xdhrv left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Looks good to me, approved 🔥

@raycastbot
raycastbot merged commit c901b6f into raycast:main Nov 27, 2026
2 checks passed
@github-actions

Copy link
Copy Markdown
Contributor

@raycastbot

Copy link
Copy Markdown
Collaborator

🎉 🎉 🎉

We've rewarded your Raycast account with some credits. You will soon be able to exchange them for some swag.

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

Labels

new extension Label for PRs with new extensions platform: macOS

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants