Skip to content

fix: force XWayland backend on Linux to fix unresponsive window controls#182

Open
GihanRathnayake wants to merge 2 commits into
erictli:mainfrom
GihanRathnayake:main
Open

fix: force XWayland backend on Linux to fix unresponsive window controls#182
GihanRathnayake wants to merge 2 commits into
erictli:mainfrom
GihanRathnayake:main

Conversation

@GihanRathnayake

Copy link
Copy Markdown

Problem

On Linux under native Wayland (reproduced on Fedora 44 / KDE Plasma / KWin), the window's title bar controls (close, minimize, maximize) are unresponsive on first click. The window's input region isn't committed until a resize, so the controls only start working after the window is maximized/restored.

Fix

Default GDK_BACKEND to x11 (XWayland) on Linux before GTK/WebKitGTK initializes. This sidesteps the native-Wayland input-region issue while leaving an explicit user-set GDK_BACKEND untouched.

#[cfg(target_os = "linux")]
if std::env::var_os("GDK_BACKEND").is_none() {
    std::env::set_var("GDK_BACKEND", "x11");
}
  • Linux-only (#[cfg(target_os = "linux")]); macOS/Windows unaffected.
  • Respects an explicit GDK_BACKEND override.
  • Set in main() before run(), so it applies before any GTK init — works in both tauri dev and shipped tauri build binaries.

Testing

  • cargo build passes.
  • Confirmed manually that GDK_BACKEND=x11 npm run tauri dev makes the close button respond on first click; this change applies that automatically.

Note: PR built and fixed with Claude Code.

GihanRathnayake and others added 2 commits June 26, 2026 15:09
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 <noreply@anthropic.com>
fix: force XWayland backend on Linux to fix unresponsive window controls
@coderabbitai

coderabbitai Bot commented Jun 26, 2026

Copy link
Copy Markdown

Caution

Review failed

An error occurred during the review process. Please try again later.

✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant