Window malfunction if create from rust backend? #14438
-
As showed in screenshot above, the "DevTools" window malfunction. tauri.conf.json{
"$schema": "https://schema.tauri.app/config/2",
"productName": "sonolight-app",
"version": "0.1.0",
"identifier": "sonolight.app",
"build": {
"beforeDevCommand": "nr dev",
"devUrl": "http://localhost:1420",
"beforeBuildCommand": "nr build",
"frontendDist": "../dist"
},
"app": {
"windows": [
{
"label": "main",
"title": "SonoLight App",
"width": 1280,
"height": 720,
"decorations": false,
"url": "index.html"
},
{
"label": "devtools",
"title": "DevTools",
"width": 800,
"height": 600,
"url": "devtools.html",
"create": false
}
],
"security": {
"csp": null
}
},
"bundle": {
"active": true,
"targets": "all",
"icon": ["icons/32x32.png", "icons/128x128.png", "icons/[email protected]", "icons/icon.icns", "icons/icon.ico"]
}
}Rust Codes#[tauri::command]
fn open_devtools_window(app: tauri::AppHandle<Wry>) {
#[cfg(debug_assertions)]
{
if let Some(win) = app.get_window("devtools") {
let _ = win.set_focus();
return;
}
let main_window_config = &app.config().app.windows[1];
let _ = tauri::window::WindowBuilder::from_config(&app.clone(), main_window_config)
.expect("[Err] failed to compose WindowBuilder from config")
.build()
.expect("[Err] failed to build WindowBuilder from config");
}
#[cfg(not(debug_assertions))]
{
println!("devtools window is not available in release mode");
}
} |
Beta Was this translation helpful? Give feedback.
Answered by
FabianLars
Nov 9, 2025
Replies: 1 comment
-
|
Make the command an |
Beta Was this translation helpful? Give feedback.
0 replies
Answer selected by
FabianLars
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment

Make the command an
async fn- ref https://docs.rs/tauri/latest/tauri/webview/struct.WebviewWindowBuilder.html#known-issues