8000 macos: add an option to launch in the background by benface · Pull Request #679 · not-fl3/miniquad · GitHub
[go: up one dir, main page]

Skip to content

macos: add an option to launch in the background - #679

Open
benface wants to merge 1 commit into
not-fl3:masterfrom
benface:macos-launch-in-background
Open

benface wants to merge 1 commit into
not-fl3:masterfrom
benface:macos-launch-in-background

Conversation

@benface
@benface benface commented Oct 9, 2026
Copy link
Copy Markdown
Contributor

Why

A macOS app always comes to the front. run sets the regular activation policy, which gives the app a Dock icon and the menu bar, orders its window front and makes it key. Then application_did_update activates the app on its first update, ignoring other apps. Conf has no option to turn any of this off.

That's right for an app someone is about to use, but not for one nobody interacts with. A game that renders frames off-screen to save them, or an app a tool launches only to screenshot its window, takes the user's focus on every run, in the middle of whatever they were typing.

Change

Platform::macos_launch_in_background, false by default. When it's set:

  • the app gets the accessory activation policy, so no Dock icon and no menu bar;
  • it skips the activation on the first update;
  • its window is ordered to the back with orderBack: and doesn't become key.

The window stays on screen, behind the others rather than hidden, so it keeps drawing and screencapture -l <window id> still captures it.

With the default, the code path is the same as before. Other platforms ignore the field.

Verification

On macOS 27, with examples/quad setting the option, on OpenGL and on Metal:

  • Over four launches, sampled every 0.3 s, the example never became the frontmost app. lsappinfo reports it as a UIElement (accessory) app, so it has no Dock icon.
  • screencapture -l of its covered window shows the rendered quads.

In a macroquad game (CHOMP) that renders its frames off-screen and saves them, the window stays covered for the whole run, and the frames are byte-identical to those from a foreground window, on both backends. A covered window keeps running at full speed: 3000 frames at a steady 120 fps, the display's refresh rate, so App Nap doesn't throttle it. Without the option, the game still comes to the front with focus.

cargo build has no new warnings. rustfmt --check flags nothing in the added lines, only formatting that's already on master.

🤖 Generated with Claude Code

@benface
benface commented Oct 9, 2026
Copy link
Copy Markdown
Contributor Author

The Android check failed before it checked out the code: Docker Hub refused to pull the notfl3/cargo-apk image ("toomanyrequests: You have reached your unauthenticated pull rate limit"). It's unrelated to this change, and a re-run of the job should pass.

A macOS app always came to the front: `run` set the regular activation
policy, which gives the app a Dock icon and the menu bar, ordered its
window front and made it key, and `application_did_update` activated
the app on its first update, ignoring other apps. An app that only
renders off-screen, or that a tool launches only to screenshot its
window, took the user's focus each time it ran.

`Platform::macos_launch_in_background` keeps it out of the way: the app
gets the accessory activation policy, so no Dock icon and no menu bar,
it skips the first-update activation, and its window goes to the back
without becoming key. The window stays on screen, so it keeps drawing
and can still be captured with `screencapture -l`.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-authored-by: multica-agent <github@multica.ai>
@benface
benface force-pushed the macos-launch-in-background branch from 556e425 to 5ac0d2d Compare October 18, 2026 18:12
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

0