Add desktop platform support #11

Open
claude-bot wants to merge 7 commits from worktree-desktop-support into main
2 changed files with 18 additions and 1 deletions
Showing only changes of commit ef37690473 - Show all commits

12
crates/web/src/desktop.rs Normal file
View file

@ -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))
}

View file

@ -1,6 +1,9 @@
mod api; mod api;
mod app; mod app;
#[cfg(feature = "desktop")]
mod desktop;
#[cfg(feature = "server")] #[cfg(feature = "server")]
mod server; mod server;
@ -14,7 +17,9 @@ fn main() {
// `#[server]` calls) — it would stand up an axum server instead of a // `#[server]` calls) — it would stand up an axum server instead of a
// window. Pick the desktop renderer explicitly in that case. // window. Pick the desktop renderer explicitly in that case.
#[cfg(feature = "desktop")] #[cfg(feature = "desktop")]
dioxus::LaunchBuilder::desktop().launch(app::App); dioxus::LaunchBuilder::desktop()
.with_cfg(desktop::config())
.launch(app::App);
#[cfg(not(feature = "desktop"))] #[cfg(not(feature = "desktop"))]
dioxus::launch(app::App); dioxus::launch(app::App);