From 57289153d1004fa6970aceb642ea967a9e18d4d3 Mon Sep 17 00:00:00 2001 From: Gihan Rathnayake Date: Fri, 26 Jun 2026 15:09:47 +0800 Subject: [PATCH] fix: force XWayland backend on Linux to fix unresponsive window controls Under native Wayland (e.g. KWin) the window's input region is not committed until a resize, leaving the title bar controls unresponsive until the window is maximized. Default GDK_BACKEND to x11 on Linux, unless the user has set it explicitly. Co-Authored-By: Claude Opus 4.8 --- src-tauri/src/main.rs | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/src-tauri/src/main.rs b/src-tauri/src/main.rs index f923db94..7d37a810 100644 --- a/src-tauri/src/main.rs +++ b/src-tauri/src/main.rs @@ -2,5 +2,14 @@ #![cfg_attr(not(debug_assertions), windows_subsystem = "windows")] fn main() { + // Force the GTK/WebKitGTK backend to use XWayland on Linux. Under native + // Wayland (e.g. KWin) the window's input region is not committed until a + // resize, leaving the title bar controls unresponsive until the window is + // maximized. Only set it when the user hasn't picked a backend themselves. + #[cfg(target_os = "linux")] + if std::env::var_os("GDK_BACKEND").is_none() { + std::env::set_var("GDK_BACKEND", "x11"); + } + scratch_lib::run() }