From ef37690473aa42e5258a094e836f0e6bcc6dcdca Mon Sep 17 00:00:00 2001 From: Austin Schaefer Date: Wed, 16 Sep 2026 14:59:03 +0200 Subject: [PATCH] Hide the desktop window's title bar and default menu Extract desktop window setup into its own crates/web/src/desktop.rs module (SRP) with a single config() function, wired into main.rs via LaunchBuilder::desktop().with_cfg(...). Disabling window decorations also clears dioxus-desktop's default native menu bar as a side effect, since it exists to give a decorated window something to hang off of. Co-Authored-By: Claude Sonnet 5 --- crates/web/src/desktop.rs | 12 ++++++++++++ crates/web/src/main.rs | 7 ++++++- 2 files changed, 18 insertions(+), 1 deletion(-) create mode 100644 crates/web/src/desktop.rs diff --git a/crates/web/src/desktop.rs b/crates/web/src/desktop.rs new file mode 100644 index 0000000..761f5c2 --- /dev/null +++ b/crates/web/src/desktop.rs @@ -0,0 +1,12 @@ +use dioxus::desktop::{Config, WindowBuilder}; + +/// Desktop window configuration: a borderless window with no OS title bar. +/// +/// Dropping decorations also drops dioxus-desktop's default native menu bar +/// (Window/Edit/Help) — the crate only keeps that menu around to give a +/// decorated window something to hang it off of, and clears it automatically +/// once `with_decorations(false)` is set, so there's nothing further to do +/// here to get rid of it. +pub fn config() -> Config { + Config::new().with_window(WindowBuilder::new().with_decorations(false)) +} diff --git a/crates/web/src/main.rs b/crates/web/src/main.rs index ce5cefb..2d1c99f 100644 --- a/crates/web/src/main.rs +++ b/crates/web/src/main.rs @@ -1,6 +1,9 @@ mod api; mod app; +#[cfg(feature = "desktop")] +mod desktop; + #[cfg(feature = "server")] mod server; @@ -14,7 +17,9 @@ fn main() { // `#[server]` calls) — it would stand up an axum server instead of a // window. Pick the desktop renderer explicitly in that case. #[cfg(feature = "desktop")] - dioxus::LaunchBuilder::desktop().launch(app::App); + dioxus::LaunchBuilder::desktop() + .with_cfg(desktop::config()) + .launch(app::App); #[cfg(not(feature = "desktop"))] dioxus::launch(app::App);