-
Notifications
You must be signed in to change notification settings - Fork 77
Macos native menubar #248
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
base: main
Are you sure you want to change the base?
Macos native menubar #248
Conversation
For history, we've discussed this before: @mockersf likes this, I don't :) |
My view on this is that people that use macOS want consistency with their OS, and people that don't use macOS want consistency across different OSes. This is kind of a mentality split. macOS has good support for menu bars and people used to it hate apps that reimplement it. Other systems don't, so it doesn't seem important to their users. There's also the fact that people on macOS tend to stay on macOS, while people on Windows/Linux tend to switch between the two. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm in favor of it so long as it doesn't impose unreasonable restrictions while keeping menu bar behavior consistent between supported editor platforms. The current solution to split the implementation based on compilation target at the Plugin level doesn't seem tenable if we ever want to expand this.
AFAIK, Unity and Unreal's editors (not sure about Godot) support a user-scripted extension interface to their menu bars that is consistent regardless of what platform the editor runs on, and I think we should support something similar.
@@ -84,3 +84,9 @@ bevy_undo = { path = "crates/bevy_undo" } | |||
bevy_infinite_grid = { path = "crates/bevy_infinite_grid" } | |||
bevy_editor_cam = { path = "crates/bevy_editor_cam" } | |||
bevy_clipboard = { path = "crates/bevy_clipboard" } | |||
|
|||
# MacOS Native Dependencies | |||
objc-rs = "0.2.8" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can you put these behind a cfg block?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm not sure how to do it in the main Cargo.toml(in this case because of the workspace)
but i could create a crate only for macos deps and use it wherever is necessary
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Or move the them in the bevy_menu_bar and put them there behind a cfg
it seems that workspace dependencies in the main Cargo.toml does not support this:
# MacOS Native Dependencies (only included when building on macOS)
[workspace.target.'cfg(target_os = "macos")'.dependencies] # or [target.'cfg(target_os = "macos")'.dependencies]
objc-rs = "0.2.8"
objc2 = "0.6.2"
objc2-app-kit = "0.3.1"
objc2-foundation = "0.3.1"
rust analyzer says:
Caused by: failed to load manifest for dependency `bevy_menu_bar` Caused by: failed to parse manifest at `/Users/aminwhat/Desktop/Projects/bevy_editor_prototypes/bevy_widgets/bevy_menu_bar/Cargo.toml` Caused by: error inheriting `objc-rs` from workspace root manifest's `workspace.dependencies.objc-rs` Caused by: `dependency.objc-rs` was not found in `workspace.dependencies
@@ -7,5 +7,11 @@ edition = "2024" | |||
bevy.workspace = true | |||
bevy_editor_styles.workspace = true | |||
|
|||
objc-rs.workspace = true |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Same here.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
here it works:
[package]
name = "bevy_menu_bar"
version = "0.1.0"
edition = "2024"
[dependencies]
bevy.workspace = true
bevy_editor_styles.workspace = true
[target.'cfg(target_os = "macos")'.dependencies]
objc-rs.workspace = true
objc2.workspace = true
objc2-app-kit.workspace = true
objc2-foundation.workspace = true
[lints]
workspace = true
but i'm not sure if it fixes that mac os native deps does not pull by the rust analyzer on windows or linux
I'm very for having a macOS native menu bar. I like when my software feels integrated into the OS I'm using! If you use macOS you expect to have a native menu bar, I think it's more confusing for users that expect that to find it integrated into the window. |
…platform specific deps
Hi there
I was working with the simple editor example and saw the menu bar on the top
kinda didn't like it on mac ;)
so i've added the macos native menu bar, on window still uses the previous menu bar(it least it should) but on mac it uses the macos native menu bar at the top
i didn't know if it is wanted it or not, so i've created the pull request