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

Modify shortcut for closing scene on macOS only #88913

Merged
merged 1 commit into from
Mar 4, 2024

Conversation

Cass-dev-web
Copy link
Contributor

@Cass-dev-web Cass-dev-web commented Feb 27, 2024

(Closes #4195)

  • Adds an override for MacOS which makes the scene closing shortcut be the default MacOS close tab shortcut (command + W)

editor/editor_node.cpp Outdated Show resolved Hide resolved
@akien-mga akien-mga modified the milestones: 4.x, 4.3 Feb 28, 2024
@@ -6693,6 +6693,7 @@ EditorNode::EditorNode() {
file_menu->add_separator();
file_menu->add_shortcut(ED_SHORTCUT_AND_COMMAND("editor/reload_saved_scene", TTR("Reload Saved Scene")), EDIT_RELOAD_SAVED_SCENE);
file_menu->add_shortcut(ED_SHORTCUT_AND_COMMAND("editor/close_scene", TTR("Close Scene"), KeyModifierMask::CMD_OR_CTRL + KeyModifierMask::SHIFT + Key::W), FILE_CLOSE);
ED_SHORTCUT_OVERRIDE("editor/close_scene", "macos", KeyModifierMask::CMD_OR_CTRL + Key::W);
Copy link
Member

Choose a reason for hiding this comment

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

It's a shortcut used on macOS to close tabs/documents, but we are already using it for script_editor/close_file, so it will cause a conflict.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

After testing, there's no conflict when the scripts are open. It first closes all the scripts and then closes the scene when repeatedly pressing Command + W.

@akien-mga akien-mga requested a review from Calinou March 1, 2024 13:51
@akien-mga akien-mga merged commit 82fbbc9 into godotengine:master Mar 4, 2024
16 checks passed
@akien-mga
Copy link
Member

Thanks!

@passivestar
Copy link
Contributor

After testing, there's no conflict when the scripts are open. It first closes all the scripts and then closes the scene when repeatedly pressing Command + W.

I'm afraid this isn't true? Pressing Command + W closes scenes for me, not opened scripts. Closing opened scripts is broken for me now (even with no scenes opened) because "Close Scene" prevents it from happening:

Screen.Recording.mp4

I've been doing some research for godotengine/godot-proposals#9311 to figure out how to make Command+W work for popups and faced this same problem. It's important to make Command+W work in all 3 places depending on focus. But looks like we need to prevent the global shortcut from hijacking input for this to work

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

Successfully merging this pull request may close these issues.

Use the standard macOS shortcut for closing scene and script tabs (Command + W)
4 participants