Skip to content

Fix blank WebKit window in Wayland AppImage sessions - #175

Merged
zouyonghe merged 4 commits into
mainfrom
copilot/fix-wayland-white-screen-issue
Sep 1, 2026
Merged

Fix blank WebKit window in Wayland AppImage sessions#175
zouyonghe merged 4 commits into
mainfrom
copilot/fix-wayland-white-screen-issue

Conversation

Copilot AI commented Aug 31, 2026

Copy link
Copy Markdown
Contributor

AstrBot AppImage could open a blank window on KDE Plasma Wayland while WebKitWebProcess aborted with EGL_BAD_PARAMETER; the backend remained reachable on localhost.

  • Linux AppImage fallback
    • Detect AppImage launches in Wayland sessions.
    • Set GTK’s backend to X11 before Tauri/WebKit initialization, avoiding the bundled Wayland/EGL path.
    • Preserve a user-provided GDK_BACKEND value.
if wayland_display.is_some() && appimage.is_some() && existing_gdk_backend.is_none() {
    std::env::set_var("GDK_BACKEND", "x11");
}
  • Coverage
    • Add focused cases for Wayland AppImage fallback, non-AppImage launches, missing Wayland display, and explicit backend overrides.

Summary by Sourcery

Fix Linux AppImage WebKit startup failures on Wayland by selecting a compatible GTK backend before desktop initialization.

Bug Fixes:

  • Prevent blank WebKit windows in Linux AppImage sessions running under Wayland by defaulting GTK to X11 when no backend override is provided.

Enhancements:

  • Apply the workaround before Tauri initialization while preserving explicit GDK backend settings.

Tests:

  • Add coverage for AppImage and AppDir detection, Wayland requirements, and explicit GDK backend overrides.

Copilot AI and others added 2 commits August 31, 2026 03:22
Co-authored-by: zouyonghe <62183434+zouyonghe@users.noreply.github.com>
Co-authored-by: zouyonghe <62183434+zouyonghe@users.noreply.github.com>
Copilot AI changed the title [WIP] Fix white screen issue in Wayland environment on ArchLinux Fix blank WebKit window in Wayland AppImage sessions Aug 31, 2026
Copilot AI requested a review from zouyonghe August 31, 2026 03:25
@zouyonghe
zouyonghe marked this pull request as ready for review August 31, 2026 13:17

@sourcery-ai sourcery-ai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hey - I've found 1 issue

Prompt for AI Agents
Please address the comments from this code review:

## Individual Comments

### Comment 1
<location path="src-tauri/src/app_runtime.rs" line_range="8-18" />
<code_context>

 #[cfg(target_os = "linux")]
 mod linux_webkit_workaround {
+    const APPIMAGE_ENV: &str = "APPIMAGE";
+    const GDK_BACKEND_ENV: &str = "GDK_BACKEND";
     const WEBKIT_DISABLE_DMABUF_RENDERER_ENV: &str = "WEBKIT_DISABLE_DMABUF_RENDERER";
     const WAYLAND_DISPLAY_ENV: &str = "WAYLAND_DISPLAY";

+    fn should_set_gdk_backend_env(
+        existing_value: Option<&std::ffi::OsStr>,
+        wayland_display: Option<&std::ffi::OsStr>,
+        appimage: Option<&std::ffi::OsStr>,
+    ) -> bool {
+        existing_value.is_none() && wayland_display.is_some() && appimage.is_some()
+    }
+
</code_context>
<issue_to_address>
**issue (broader_impact):** The fallback recognizes only the `APPIMAGE` marker, so an AppImage-style launch that exposes `APPDIR` without `APPIMAGE` does not set `GDK_BACKEND=x11` and can still enter the bundled Wayland/EGL path. This is inconsistent with `is_linux_appimage_runtime`, which already treats either `APPIMAGE` or `APPDIR` as an AppImage runtime.

**Triggers:** When the AppImage runtime provides `APPDIR` but not `APPIMAGE`.

**Suggested fix:** Detect `APPDIR` as an AppImage marker as well, or reuse the existing Linux AppImage runtime detection helper.
</issue_to_address>

Sourcery assessment

Approval pending. 1 finding to address first.

Blocking findings: src-tauri/src/app_runtime.rs:18


Sourcery is free for open source - if you like our reviews please consider sharing them ✨
Help me be more useful! Please click 👍 or 👎 on each comment and I'll use the feedback to improve your reviews.

Comment thread src-tauri/src/app_runtime.rs Outdated

@sourcery-ai sourcery-ai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sourcery assessment

Approved.

@zouyonghe

Copy link
Copy Markdown
Member

@sourcery-ai review

@sourcery-ai sourcery-ai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hey - I've reviewed your changes and they look great!

Sourcery assessment

Approved.


Sourcery is free for open source - if you like our reviews please consider sharing them ✨
Help me be more useful! Please click 👍 or 👎 on each comment and I'll use the feedback to improve your reviews.

@zouyonghe
zouyonghe merged commit 391d248 into main Sep 1, 2026
4 checks passed
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.

[Bug] ArchLinux下使用KDE Plasma Wayland环境下白屏

2 participants