From 8e0aa401db654b8a5e91709734ac8ae3c36ff453 Mon Sep 17 00:00:00 2001 From: Tarek Abdel Sater Date: Sat, 7 Feb 2026 16:49:32 +0400 Subject: [PATCH] Expose winit's option to hide dock/menu bar on macOS Fixes #14783 Winit 0.30 added a window attribute that hides the dock and menu bar when using on macOS. This exposes that option as a field on Bevy's component, defaulting to since this is the expected behavior for games. --- crates/bevy_window/src/window.rs | 13 +++++++++++++ crates/bevy_winit/src/winit_windows.rs | 3 ++- 2 files changed, 15 insertions(+), 1 deletion(-) diff --git a/crates/bevy_window/src/window.rs b/crates/bevy_window/src/window.rs index 98c9973e2f7ce..01e023793ca89 100644 --- a/crates/bevy_window/src/window.rs +++ b/crates/bevy_window/src/window.rs @@ -432,6 +432,18 @@ pub struct Window { /// /// [`WindowAttributesExtMacOS::with_titlebar_buttons_hidden`]: https://docs.rs/winit/latest/x86_64-apple-darwin/winit/platform/macos/trait.WindowAttributesExtMacOS.html#tymethod.with_titlebar_buttons_hidden pub titlebar_show_buttons: bool, + /// Hides the dock and menu bar when a borderless fullscreen window is active. + /// + /// Corresponds to [`WindowAttributesExtMacOS::with_borderless_game`]. + /// + /// Defaults to `true` as this is the expected behavior for games. + /// + /// # Platform-specific + /// + /// - Only used on macOS. + /// + /// [`WindowAttributesExtMacOS::with_borderless_game`]: https://docs.rs/winit/latest/x86_64-apple-darwin/winit/platform/macos/trait.WindowAttributesExtMacOS.html#tymethod.with_borderless_game + pub borderless_game: bool, /// Sets whether the Window prefers the home indicator hidden. /// /// Corresponds to [`WindowAttributesExtIOS::with_prefers_home_indicator_hidden`]. @@ -504,6 +516,7 @@ impl Default for Window { titlebar_transparent: false, titlebar_show_title: true, titlebar_show_buttons: true, + borderless_game: true, prefers_home_indicator_hidden: false, prefers_status_bar_hidden: false, preferred_screen_edges_deferring_system_gestures: Default::default(), diff --git a/crates/bevy_winit/src/winit_windows.rs b/crates/bevy_winit/src/winit_windows.rs index ea885efa90402..3afc49bac85cb 100644 --- a/crates/bevy_winit/src/winit_windows.rs +++ b/crates/bevy_winit/src/winit_windows.rs @@ -152,7 +152,8 @@ impl WinitWindows { .with_titlebar_hidden(!window.titlebar_shown) .with_titlebar_transparent(window.titlebar_transparent) .with_title_hidden(!window.titlebar_show_title) - .with_titlebar_buttons_hidden(!window.titlebar_show_buttons); + .with_titlebar_buttons_hidden(!window.titlebar_show_buttons) + .with_borderless_game(window.borderless_game); } #[cfg(target_os = "ios")]