Skip to content

fix: Auto-detect WSL and default to X11 for clipboard compatibility - #20

Merged
srperens merged 1 commit into
mainfrom
fix/wsl-clipboard-x11-default
Nov 21, 2025
Merged

fix: Auto-detect WSL and default to X11 for clipboard compatibility#20
srperens merged 1 commit into
mainfrom
fix/wsl-clipboard-x11-default

Conversation

@srperens

Copy link
Copy Markdown
Collaborator

Summary

  • Adds WSL detection via /proc/version to auto-detect when running under Windows Subsystem for Linux
  • Defaults to X11 display backend on WSL (fixes clipboard crashes with smithay-clipboard)
  • Defaults to Wayland on native Linux
  • Adds --x11 and --wayland CLI flags to override the platform defaults

Problem

WSL2 with WSLg has clipboard issues with the smithay-clipboard library (Wayland clipboard), causing GUI crashes on Windows 11 with errors like:

  • The X11 server closed the connection
  • Connection reset by peer
  • WinitEventLoop(ExitFailure(1))

Solution

By detecting WSL and forcing X11 mode (setting WAYLAND_DISPLAY=""), the application uses arboard's X11 clipboard implementation instead of the problematic smithay-clipboard Wayland implementation.

Test plan

  • Tested on WSL2/Windows 11 - GUI starts without clipboard crashes
  • Test on native Linux - should default to Wayland
  • Test --x11 flag on native Linux
  • Test --wayland flag on WSL

🤖 Generated with Claude Code

WSL2 with WSLg has clipboard issues with the smithay-clipboard library
(Wayland clipboard), causing GUI crashes on Windows 11. This change:

- Adds WSL detection via /proc/version
- Defaults to X11 on WSL (working clipboard via arboard)
- Defaults to Wayland on native Linux
- Adds --x11 and --wayland CLI flags to override defaults

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>
@srperens
srperens merged commit 931e6da into main Nov 21, 2025
8 checks passed
@srperens
srperens deleted the fix/wsl-clipboard-x11-default branch November 25, 2025 13:57
birme pushed a commit to eyevinn-osaas/strom that referenced this pull request Feb 2, 2026
fix: Auto-detect WSL and default to X11 for clipboard compatibility
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