Skip to content

Conversation

@Guibi1
Copy link

@Guibi1 Guibi1 commented Aug 20, 2025

This PR adds the option to prevent the event loop from exiting when the last window is closed by the user.

This is needs more thought because:

  1. The naming might not be the best
  2. This wasnt tested on all platforms
  3. MacOS is special and we need to make a decision on the api about the fact that it has the opposite behaviours as the other os

Release Notes:

  • Added the option to keep the application running with no window open

@cla-bot
Copy link

cla-bot bot commented Aug 20, 2025

We require contributors to sign our Contributor License Agreement, and we don't have @Guibi1 on file. You can sign our CLA at https://zed.dev/cla. Once you've signed, post a comment here that says '@cla-bot check'.

@Guibi1
Copy link
Author

Guibi1 commented Aug 20, 2025

@cla-bot check

@cla-bot cla-bot bot added the cla-signed The user has signed the Contributor License Agreement label Aug 20, 2025
@cla-bot
Copy link

cla-bot bot commented Aug 20, 2025

The cla-bot has been summoned, and re-checked this pull request!

@JunkuiZhang
Copy link
Contributor

I’m curious why do you need this feature? AFAIK, on Windows pretty much all apps exit once the window is closed, unless they’ve got a tray icon like Steam.

@Guibi1
Copy link
Author

Guibi1 commented Aug 20, 2025

Exactly. Currently its impossible to do a system tray without running another event loop outside of gpui and doing an Application:new each time you need to open the app.

@unsecretised
Copy link

I found a way to add a tray icon if thats what you are looking for...
https://github.com/TeenCoder159/macos-template/blob/main/gpui/src/main.rs

however, exposing the event loop + adding a bunch more configurable options is needed (such as setting window visibility)

@Guibi1 Guibi1 marked this pull request as ready for review August 26, 2025 02:01
Guibi1 added a commit to Guibi1/zed that referenced this pull request Aug 29, 2025
Guibi1 added a commit to Guibi1/zed that referenced this pull request Sep 3, 2025
Guibi1 added a commit to Guibi1/zed that referenced this pull request Sep 16, 2025
Guibi1 added a commit to Guibi1/zed that referenced this pull request Sep 16, 2025
@mikayla-maki
Copy link
Member

Hello!

I think a better fix would be to remove the behavior from the GPUI platform entirely, so that all applications stay running after the last window is closed.

Then we can re-implement this at the application level.

mikayla-maki added a commit that referenced this pull request Nov 10, 2025
…41436)

This commit is a continuation of #36548. As per [mikayla-maki's
Comment](#36548 (comment)),
I removed the process management behavior located in GPUI and
reimplemented it in Zed.

Release Notes:

- N/A

---------

Co-authored-by: Mikayla Maki <[email protected]>
@Ciantic
Copy link

Ciantic commented Nov 28, 2025

I came here from search. For completness, here is example how to turn the feature on.

This is not released in crates (version 0.2.2) yet, but it works like this in the branch.

Application::new()
  .with_quit_mode(QuitMode::Explicit)

or

Application::new().run(|cx: &mut App| {
  cx.set_quit_mode(QuitMode::Explicit);

11happy pushed a commit to 11happy/zed that referenced this pull request Dec 1, 2025
…ed-industries#41436)

This commit is a continuation of zed-industries#36548. As per [mikayla-maki's
Comment](zed-industries#36548 (comment)),
I removed the process management behavior located in GPUI and
reimplemented it in Zed.

Release Notes:

- N/A

---------

Co-authored-by: Mikayla Maki <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

cla-signed The user has signed the Contributor License Agreement

Projects

None yet

Development

Successfully merging this pull request may close these issues.

8 participants