[bug] It still doesn't display the window borders correctly on Windows 10.
Describe the bug
When I set decorations to false, the initial window has no left or bottom border. However, when I resize the window, they appear. But it's noticeable that their color is different—slightly darker.
Reproduction
No response
Expected behavior
No response
Full tauri info output
[✔] Environment
- OS: Windows 10.0.19045 x86_64 (X64)
✔ WebView2: 130.0.2849.80
✔ MSVC: Visual Studio Community 2022
✔ rustc: 1.82.0 (f6e511eec 2024-10-15)
✔ cargo: 1.82.0 (8f40fc59f 2024-08-21)
✔ rustup: 1.27.1 (54dd3d00f 2024-04-24)
✔ Rust toolchain: stable-x86_64-pc-windows-msvc (environment override by RUSTUP_TOOLCHAIN)
- node: 20.13.1
- pnpm: 9.12.3
- yarn: 1.22.22
- npm: 10.8.1
[-] Packages
- tauri 🦀: 2.1.1
- tauri-build 🦀: 2.0.3
- wry 🦀: 0.47.0
- tao 🦀: 0.30.8
- tauri-cli 🦀: 2.0.2
- @tauri-apps/api : 2.1.1
- @tauri-apps/cli : 2.0.2 (outdated, latest: 2.1.0)
[-] Plugins
- tauri-plugin-shell 🦀: 2.0.2
- @tauri-apps/plugin-shell : 2.0.1
[-] App
- build-type: bundle
- CSP: unset
- frontendDist: ../dist
- devUrl: http://localhost:1420/
- framework: SolidJS
- bundler: Vite
Stack trace
No response
Additional context
No response
I can't seem to reproduce on Windows 11, here is a comparison with windows settings app
I can't test on Windows 10 atm as I don't have it installed, but hopefully I can install it soon and test
Also noticed this problem with the plugins' example on Windows 10 (changed the left bar's background color to white to better demonstrate the problem)
+1
Hello. I can confirm the same behaviour (in Windows10) as soon as I upgraded the app to Tauri v2. The "native" window/form border/decoration is somewhat still there, causing artifacts and messing with the custom border/decoration.
+1
it reproduce on my environment (Windows 10 22H2 19045.5198).
But I fixed this by set the window's shadow attribute to false in tauri.conf.json
If implementing the default system borders on Windows 10 is too difficult, could we simply hide the borders and only keep the shadow, just like in Electron?
+1
+1 it reproduce on my environment (Windows 10 22H2 19045.5198). But I fixed this by set the window's
shadowattribute tofalseintauri.conf.json
Great! Thanks. I can live with that. Though I left the tauri.conf.json unmodified (decorations and shadow are true) and I am using the setShadow() and setDecorations() of appWindow (in that order) to be able to modify dynamically without rebuilding.
workaround
- change
shadowintauri.conf.jsontofalse, like that:
"windows": [
{
"title": "Window",
"width": "<width>",
"height": "<height>",
"shadow": false,
}
],
- install
os_infocrate:
cd src-tauri
cargo add os_info
- add the following workaround to
main.rs:
fn is_win10() -> bool {
let info = os_info::get();
if info.os_type() != os_info::Type::Windows {
return false;
}
info.version()
.to_string()
.split('.')
.last()
.and_then(|s| s.parse::<u32>().ok())
.map_or(false, |patch| patch < 22000)
}
// tauri builder in async fn main
.setup(|app| {
let main_window = app.get_webview_window("main")
.expect("no main window");
if !is_win10() {
let _ = main_window.set_shadow(true);
}
Ok(())
})
it's definitely not the best solution, its ugly, but it works
this is fixed by https://github.com/tauri-apps/tao/pull/1052, and will be available in the next release
closed by #12541 #12817