Skip to content

gpui: Move 'app closing on last window closed' behavior to app-side#41436

Merged
mikayla-maki merged 2 commits intozed-industries:mainfrom
Tryanks:closing-behavior
Nov 10, 2025
Merged

gpui: Move 'app closing on last window closed' behavior to app-side#41436
mikayla-maki merged 2 commits intozed-industries:mainfrom
Tryanks:closing-behavior

Conversation

@Tryanks
Copy link
Contributor

@Tryanks Tryanks commented Oct 29, 2025

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

Release Notes:

  • N/A

@cla-bot
Copy link

cla-bot bot commented Oct 29, 2025

We require contributors to sign our Contributor License Agreement, and we don't have @Tryanks 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'.

@Tryanks
Copy link
Contributor Author

Tryanks commented Oct 29, 2025

@cla-bot check

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

cla-bot bot commented Oct 29, 2025

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

@maxdeviant maxdeviant changed the title gpui: Move 'app closing on last window closed' behavior to app-side. gpui: Move 'app closing on last window closed' behavior to app-side Oct 29, 2025
@mikayla-maki mikayla-maki removed their assignment Nov 10, 2025
Copy link
Member

@mikayla-maki mikayla-maki left a comment

Choose a reason for hiding this comment

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

PR looks good to me! Pretty simple implementation too :D

cc: @smitbarmase @reflectronic can you both test this on Windows and Linux and make sure it's working correctly?

@reflectronic
Copy link
Member

I like the approach in #36548 better. I don't think this is a reasonable default behavior for Windows or Linux.

Copy link
Member

@smitbarmase smitbarmase left a comment

Choose a reason for hiding this comment

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

Tested on Linux. Works as expected.

@Tryanks
Copy link
Contributor Author

Tryanks commented Nov 10, 2025

I like the approach in #36548 better. I don't think this is a reasonable default behavior for Windows or Linux.

I agree. Another idea was to add a GPUI-level subscription for when the last window closes. If the signal has no subscribers, the platform's default behavior applies. If it has any subscribers, the default quit is prevented, letting the subscriber decide.

On macOS, Zed would subscribe to this and respect the user setting. Third-party apps could subscribe and do nothing to keep running with no windows open.

Copy link
Member

@reflectronic reflectronic left a comment

Choose a reason for hiding this comment

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

We agree that GPUI should have a default policy of exiting the app when all windows are closed on Windows and Linux, but we'd like to move this into the cross-platform layer instead of hard-coding it for each platform. This PR does some of that refactoring, so, to that end, we will accept it. In a follow-up, we will re-introduce that behavior, with an opt-out for apps like Zed that want explicit control.

@mikayla-maki
Copy link
Member

@Tryanks if you could do a quick cargo format, we can get this merge :)

@mikayla-maki mikayla-maki enabled auto-merge (squash) November 10, 2025 17:11
@mikayla-maki mikayla-maki merged commit ddf5937 into zed-industries:main Nov 10, 2025
24 checks passed
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 <mikayla.c.maki@gmail.com>
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.

4 participants