[PR #13143] fix(desktop): normalize Linux Wayland/X11 backend and decoration policy #14533

Closed
opened 2026-02-16 18:19:19 -05:00 by yindo · 0 comments
Owner

Original Pull Request: https://github.com/anomalyco/opencode/pull/13143

State: closed
Merged: Yes


Closes #6258
Related to #6168

Summary

  • Add a linux_windowing module (Rust) that handles backend selection and decoration policy
  • Env overrides (OC_FORCE_X11, OC_FORCE_WAYLAND, OC_ALLOW_WAYLAND) take priority; then user settings; then auto-detection (Wayland-first, X11 fallback)
  • Hide native window decorations when a tiling WM is detected (sway, hyprland, niri, i3, dwm, bspwm, river, qtile, xmonad, awesome, and others); keep decorations in full desktop environments (GNOME, KDE, XFCE, etc.)
  • Users can override decoration behavior with OC_LINUX_DECORATIONS=native|none|auto
  • Tiling WM detection works on both X11 and Wayland sessions

Why

On Niri (Wayland), OpenCode launched on XWayland by default unless the user forced Wayland explicitly. The new module makes backend selection explicit and predictable: Wayland first, X11 only as fallback. It also detects tiling window managers and hides decorations automatically, eliminating unwanted title bars in sessions like i3 on X11.

Verification

  • Built the desktop app with bun run --cwd packages/desktop tauri build
  • Launched the production binary: ./packages/desktop/src-tauri/target/release/OpenCode
  • Verified on a Wayland tiling WM session:
    • Default startup falls back to XWayland correctly
    • OC_ALLOW_WAYLAND=1 starts native Wayland with no title bar decorations
  • A SessionEnv struct makes the logic fully testable without touching real env vars
  • Ran cargo test --manifest-path packages/desktop/src-tauri/Cargo.toml linux_windowing — 22 tests passed
**Original Pull Request:** https://github.com/anomalyco/opencode/pull/13143 **State:** closed **Merged:** Yes --- Closes #6258 Related to #6168 ## Summary - Add a `linux_windowing` module (Rust) that handles backend selection and decoration policy - Env overrides (`OC_FORCE_X11`, `OC_FORCE_WAYLAND`, `OC_ALLOW_WAYLAND`) take priority; then user settings; then auto-detection (Wayland-first, X11 fallback) - Hide native window decorations when a tiling WM is detected (sway, hyprland, niri, i3, dwm, bspwm, river, qtile, xmonad, awesome, and others); keep decorations in full desktop environments (GNOME, KDE, XFCE, etc.) - Users can override decoration behavior with `OC_LINUX_DECORATIONS=native|none|auto` - Tiling WM detection works on both X11 and Wayland sessions ## Why On Niri (Wayland), OpenCode launched on XWayland by default unless the user forced Wayland explicitly. The new module makes backend selection explicit and predictable: Wayland first, X11 only as fallback. It also detects tiling window managers and hides decorations automatically, eliminating unwanted title bars in sessions like i3 on X11. ## Verification - Built the desktop app with `bun run --cwd packages/desktop tauri build` - Launched the production binary: `./packages/desktop/src-tauri/target/release/OpenCode` - Verified on a Wayland tiling WM session: - Default startup falls back to XWayland correctly - `OC_ALLOW_WAYLAND=1` starts native Wayland with no title bar decorations - A `SessionEnv` struct makes the logic fully testable without touching real env vars - Ran `cargo test --manifest-path packages/desktop/src-tauri/Cargo.toml linux_windowing` — 22 tests passed
yindo added the pull-request label 2026-02-16 18:19:19 -05:00
yindo closed this issue 2026-02-16 18:19:19 -05:00
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: anomalyco/opencode#14533