Closed fnune closed 2 weeks ago
I've seen this other issue: https://github.com/tauri-apps/tauri/issues/4777
I'm trying to center my window like this:
"app": { "windows": [ { "title": "Flash", "decorations": false, "center": true } ] }
But it opens in the top-left corner:
I can also try to hide it and then center it in Rust, following the tips from the aforementioned issue, but that doesn't work either (same result):
"app": { "windows": [ { "title": "Flash", "decorations": false, "center": true, "visible": false } ] }
In Rust:
#![cfg_attr(not(debug_assertions), windows_subsystem = "windows")] use tauri::Manager; fn main() { tauri::Builder::default() .setup(|app| { let main_window = app.get_webview_window("main").unwrap(); tauri::async_runtime::spawn(async move { main_window.show().unwrap(); main_window.center().unwrap(); }); Ok(()) }) .invoke_handler(tauri::generate_handler![]) .run(tauri::generate_context!()) .expect("error while running tauri application"); }
{ "build": { "beforeDevCommand": "pnpm dev", "beforeBuildCommand": "pnpm build", "frontendDist": "../dist", "devUrl": "http://localhost:1420" }, "bundle": { "active": true, "targets": "all", "icon": [ "icons/32x32.png", "icons/128x128.png", "icons/128x128@2x.png", "icons/icon.icns", "icons/icon.ico" ] }, "productName": "flash", "version": "0.1.0", "identifier": "com.fnune.flash", "plugins": {}, "app": { "windows": [ { "title": "Flash", "decorations": false, "center": true, "visible": false } ] } }
Expecting more or less this:
tauri info
~/Development/flash => pnpm tauri info > flash@0.1.0 tauri /home/fausto/Development/flash > tauri "info" [✔] Environment - OS: NixOS 24.05 X64 ✔ webkit2gtk-4.1: 2.44.3 ✔ rsvg2: 2.58.2 ✔ rustc: 1.80.1 (3f5fd8dd4 2024-08-06) ✔ cargo: 1.80.1 (376290515 2024-07-16) ✔ rustup: 1.27.1 (1980-01-01) ✔ Rust toolchain: - node: 20.15.1 - pnpm: 9.7.0 - npm: 10.7.0 [-] Packages - tauri [RUST]: 2.0.0-rc.6 - tauri-build [RUST]: 2.0.0-rc.6 - wry [RUST]: 0.42.0 - tao [RUST]: 0.29.1 - @tauri-apps/api [NPM]: 2.0.0-rc.3 - @tauri-apps/cli [NPM]: 2.0.0-rc.7 [-] App - build-type: bundle - CSP: unset - frontendDist: ../dist - devUrl: http://localhost:1420/ - framework: React - bundler: Vite
### Stack trace _No response_ ### Additional context _No response_
Duplicated with #9768
Describe the bug
I've seen this other issue: https://github.com/tauri-apps/tauri/issues/4777
I'm trying to center my window like this:
But it opens in the top-left corner:
I can also try to hide it and then center it in Rust, following the tips from the aforementioned issue, but that doesn't work either (same result):
In Rust:
Reproduction
Expected behavior
Expecting more or less this:
Full
tauri info
output