fix(titlebar): re-focus window after re-enabling native decorations on GTK

GTK re-stacks the window when set_decorations(true) is called, causing it
to lose focus and sink behind other windows. Call set_focus() immediately
after to bring it back to the front.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
Psychotoxical
2026-04-07 22:01:42 +02:00
parent 2c3c89f078
commit 900853fedc
+5
View File
@@ -41,6 +41,11 @@ fn exit_app(app_handle: tauri::AppHandle) {
fn set_window_decorations(enabled: bool, app_handle: tauri::AppHandle) { fn set_window_decorations(enabled: bool, app_handle: tauri::AppHandle) {
if let Some(win) = app_handle.get_webview_window("main") { if let Some(win) = app_handle.get_webview_window("main") {
let _ = win.set_decorations(enabled); let _ = win.set_decorations(enabled);
// Re-enabling native decorations on GTK causes the window manager to
// re-stack the window, which drops focus. Bring it back immediately.
if enabled {
let _ = win.set_focus();
}
} }
} }