Some checks failed
CI / fmt (pull_request) Successful in 15s
CI / clippy-web (pull_request) Has been cancelled
CI / clippy-desktop (pull_request) Has been cancelled
CI / test (pull_request) Has been cancelled
CI / audit (pull_request) Has been cancelled
CI / clippy-server (pull_request) Has been cancelled
CI / clippy-native (pull_request) Has been cancelled
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 <noreply@anthropic.com>
26 lines
737 B
Rust
26 lines
737 B
Rust
mod api;
|
|
mod app;
|
|
|
|
#[cfg(feature = "desktop")]
|
|
mod desktop;
|
|
|
|
#[cfg(feature = "server")]
|
|
mod server;
|
|
|
|
fn main() {
|
|
#[cfg(feature = "server")]
|
|
server::init_tracing();
|
|
|
|
// `dioxus::launch`'s automatic platform detection prioritizes "server"
|
|
// over "desktop" when both features are enabled (as they are for the
|
|
// desktop build, which embeds the server feature for in-process
|
|
// `#[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()
|
|
.with_cfg(desktop::config())
|
|
.launch(app::App);
|
|
|
|
#[cfg(not(feature = "desktop"))]
|
|
dioxus::launch(app::App);
|
|
}
|