godotengine / godot-proposals

Godot Improvement Proposals (GIPs)
MIT License
1.16k stars 97 forks source link

Bring back exit prompt #8222

Closed Wolfyxon closed 1 year ago

Wolfyxon commented 1 year ago

Describe the project you are working on

I don't think it's important here, but I'm working on a rhythm arcade game.

Describe the problem or limitation you are having in your project

I use i3 as my desktop environment and it doesn't require you to click on a window to focus it, you just need to move your mouse on it or use a keyboard shortcut. However when my mouse slips into the editor while I'm debugging or Godot forcefully focuses itself, and I use the alt+f4 keyboard shortcut to close the game, I close the editor which is very annoying.

Describe the feature / enhancement and how it helps to overcome the problem or limitation

It existed in Godot 3, whenever you wanted to close the editor a "Do you want to quit?" window would popup. It would stop me people closing Godot. And If people don't like it, it can be disabled in the editor settings.

Describe how your proposal will work, with code, pseudo-code, mock-ups, and/or diagrams

func _on_quit_request():
   if not EditorSettings.get_setting("editor/ask_before_quitting"): return
   var prompt = ExitPrompt.new()
   prompt.popup()
   var result = await prompt.action_clicked
   if result:
      get_tree().quit()

If this enhancement will not be used often, can it be worked around with a few lines of script?

Possibly this can be done with a EditorPlugin.

Is there a reason why this should be core and not an add-on in the asset library?

Already a lot of software asks you before quitting and it's a very simple feature. Also why was it removed in the first place? Did it become a setting I just cannot find?

KoBeWi commented 1 year ago

Already a lot of software asks you before quitting and it's a very simple feature.

I don't think I know any software that asks before quitting if you don't have unsaved changes. And Godot is reliable in detecting unsaved stuff.

That said, if it was an editor setting then it's probably ok. And it actually used to be an editor setting, enabled by default. It was removed here: https://github.com/godotengine/godot/pull/32321 The rationale was that confirmation is useless if you don't have unsaved changes (which is usually true). If instead the default was changed to don't ask, we'd have a typical case of an obscure feature.

EDIT: Related (duplicate?): #6915

Calinou commented 1 year ago

Thanks for the proposal! Consolidating in https://github.com/godotengine/godot-proposals/issues/6915.

CarpenterBlue commented 10 months ago

Already a lot of software asks you before quitting and it's a very simple feature.

I don't think I know any software that asks before quitting if you don't have unsaved changes. And Godot is reliable in detecting unsaved stuff.

That said, if it was an editor setting then it's probably ok. And it actually used to be an editor setting, enabled by default. It was removed here: godotengine/godot#32321 The rationale was that confirmation is useless if you don't have unsaved changes (which is usually true). If instead the default was changed to don't ask, we'd have a typical case of an obscure feature.

EDIT: Related (duplicate?): #6915

But to run the game you have to save the project. That frequently creates opportunity to accidentally close the project when you are aiming to close the game. This opportunity grows exponentially more likely if you are using exported variables or hot script reloading. AND juggling other software also becomes a factor.

In this case, breaking the convention would be acceptable. Godot should be marked dirty when the game was just ran to prevent this behaviour or this should be reverted.

AThousandShips commented 10 months ago

Please don't comment on duplicate issues but instead on the open one that was linked, it's pointless to add here alone as it's closed as a duplicate