so my goal is to remove the titlebar from my Tauri window without removing all the other decorations stuff like the borders, shadows and rounded corners on windows 11.
I’m using the winapi and the windows libraries to modify the window like shown in the code below:
use tauri::Manager;
use windows::{
Win32::Foundation::HWND,
Win32::UI::WindowsAndMessaging::{
GetWindowLongW, SetWindowLongW, GWL_STYLE,
},
};
use winapi::um::winuser::{WS_CAPTION};
fn main() {
tauri::Builder::default()
.invoke_handler(tauri::generate_handler![greet])
.setup(|app| {
let window = app.get_window("main").unwrap();
let hwnd = HWND(window.hwnd().unwrap().0);
unsafe {
let styles = GetWindowLongW(hwnd, GWL_STYLE);
SetWindowLongW(hwnd, GWL_STYLE, styles & !(WS_CAPTION as i32));
}
Ok(())
})
.run(tauri::generate_context!())
.expect("error while running tauri application");
}
The titlebar seem to disapear but with some weird results:
When the window just popup, a weird bar on the top appear
When i click the bar on the top this happen
And then when i resize the window, the weird bar on the top became smaller
The wanted result is near to the last image without the bar.
I algo tried to use a cargo library named window-shadows that gave me what i wanted with rounded-corners and no titlebar but resizing the window was very hard and i was losing the popup animation when starting the app.