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 a quit shortcut to the osx menu bar #464

Merged
merged 4 commits into from
Jun 29, 2024

Conversation

markmurphydev
Copy link
Contributor

Adds Command+Q functionality by adding a "Quit AppName" entry to the top menu bar. This is the normal way to implement the command-q shortcut on osx, and lets you rebind it in system keyboard settings.

Fixes not-fl3/macroquad#649

Note that on osx on master, clicking on a menu bar item currently freezes the window. This is due to #455.

src/native/macos.rs Outdated Show resolved Hide resolved
let app_menu: ObjcId = msg_send![class!(NSMenu), new];

// Hook up the menu components to the application
let () = msg_send![app_menu_item, setSubmenu: app_menu];
Copy link
Owner

Choose a reason for hiding this comment

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

up to you, but there is a special macro with a dash, msg_send_![app_menu_item, setSubmenu: app_menu];

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Oh that's nicer looking. Switched to using that.

@not-fl3 not-fl3 merged commit 6ea5c3a into not-fl3:master Jun 29, 2024
10 checks passed
@not-fl3
Copy link
Owner

not-fl3 commented Jun 29, 2024

Thanks for PR!

@markmurphydev markmurphydev deleted the macos_quit_shortcut branch June 29, 2024 22:17
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Command-Q does not quit program on macOS
2 participants