From 900853fedc22af46fc0626953cc97b47ddc0fa8d Mon Sep 17 00:00:00 2001 From: Psychotoxical Date: Tue, 7 Apr 2026 22:01:42 +0200 Subject: [PATCH] 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 --- src-tauri/src/lib.rs | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/src-tauri/src/lib.rs b/src-tauri/src/lib.rs index 5d29900e..24a78387 100644 --- a/src-tauri/src/lib.rs +++ b/src-tauri/src/lib.rs @@ -41,6 +41,11 @@ fn exit_app(app_handle: tauri::AppHandle) { fn set_window_decorations(enabled: bool, app_handle: tauri::AppHandle) { if let Some(win) = app_handle.get_webview_window("main") { 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(); + } } }