Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add support for Command+W for closing dialog windows on macOS #9311

Open
passivestar opened this issue Mar 16, 2024 · 0 comments
Open

Add support for Command+W for closing dialog windows on macOS #9311

passivestar opened this issue Mar 16, 2024 · 0 comments

Comments

@passivestar
Copy link

Describe the project you are working on

Any project

Describe the problem or limitation you are having in your project

On macOS the default shortcut to close a window is Command+W (not to be confused with Command+Q which is a shortcut to close the app, like Alt+F4 on windows. Those are two different things on mac). Pressing Command+W allows you for example to close the editor settings window in Unity and Blender. But not in Godot

As a long-time macOS user, Command+W is pretty much engraved in my muscle memory. When I see a popup window I expect to be able to close it with Command+W

In Godot dialog windows use the ui_cancel shortcut for closing, which isn't something you would want rebind to Command+W as it's more generic and handles all sorts of things in the UI, not just closing dialog windows

This proposal is about dialog windows only. It's unrelated to closing opened scene tabs, which currently works on Command+W in the main window as one would expect. It should behave differently depending on whether or not a dialog window is active

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

Make it possible to close AcceptDialog by pressing Command+W

Keep the same behavior for the main window to close scenes

Note: in Unity pressing Command+W on the main window has no effect

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

I see 2 ways to solve this:

  1. Hardcode Command+W into AcceptDialog::_input_from_window

  2. Add a ui_close_dialog specifically for handling closing dialogs. It will be bound to Command+W on mac and Escape on other OSes. The AcceptDialog will keep the close_on_escape bool name and related method names to keep compatibility. Strictly speaking close_on_escape is already misnamed (ui_cancel can be bound to another key), so nothing will change in that regard

The second option keeps the _input_from_window clean and allows rebinding

In both cases we'll need to prevent the "Close Scene" shortcut from happening, because the "Close Scene" shortcut doesn't care if any dialog window is active, it will execute anyway

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

N/A

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

N/A

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

No branches or pull requests

2 participants