From 97a0f5f7a116023bb7545bc45f004597b18d2130 Mon Sep 17 00:00:00 2001 From: Chris Engelhard Date: Tue, 23 Dec 2025 09:05:34 +0100 Subject: [PATCH] fix(linux): add Wayland/NVIDIA compatibility and resolve Rust warnings MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - Add default-run = "opcode" to Cargo.toml to fix binary selection - Add automatic WEBKIT_DISABLE_DMABUF_RENDERER for Wayland sessions - Fix snake_case warnings in web_server.rs (sessionId -> session_id) - Suppress dead_code warning for register_sidecar_process 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude Sonnet 4.5 --- src-tauri/Cargo.toml | 1 + src-tauri/src/main.rs | 16 ++++++++++++++++ src-tauri/src/process/registry.rs | 1 + src-tauri/src/web_server.rs | 8 ++++---- 4 files changed, 22 insertions(+), 4 deletions(-) diff --git a/src-tauri/Cargo.toml b/src-tauri/Cargo.toml index 91288d4f6..56e43d43c 100644 --- a/src-tauri/Cargo.toml +++ b/src-tauri/Cargo.toml @@ -5,6 +5,7 @@ description = "GUI app and Toolkit for Claude Code" authors = ["mufeedvh", "123vviekr"] license = "AGPL-3.0" edition = "2021" +default-run = "opcode" # See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html diff --git a/src-tauri/src/main.rs b/src-tauri/src/main.rs index fc93adbcf..d2aaf38bb 100644 --- a/src-tauri/src/main.rs +++ b/src-tauri/src/main.rs @@ -52,6 +52,22 @@ use tauri::Manager; use window_vibrancy::{apply_vibrancy, NSVisualEffectMaterial}; fn main() { + // Apply Linux/Wayland workarounds for WebKitGTK GBM buffer issues (especially on NVIDIA) + // This must be done before any GTK/WebKit initialization + #[cfg(target_os = "linux")] + { + use std::env; + // Only apply fix for Wayland sessions where GBM buffer issues occur + let is_wayland = env::var("WAYLAND_DISPLAY").is_ok() + || env::var("XDG_SESSION_TYPE") + .map(|v| v == "wayland") + .unwrap_or(false); + + if is_wayland && env::var("WEBKIT_DISABLE_DMABUF_RENDERER").is_err() { + env::set_var("WEBKIT_DISABLE_DMABUF_RENDERER", "1"); + } + } + // Initialize logger env_logger::init(); diff --git a/src-tauri/src/process/registry.rs b/src-tauri/src/process/registry.rs index f4f33b5a2..a0b1850ca 100644 --- a/src-tauri/src/process/registry.rs +++ b/src-tauri/src/process/registry.rs @@ -82,6 +82,7 @@ impl ProcessRegistry { } /// Register a new running agent process using sidecar (similar to register_process but for sidecar children) + #[allow(dead_code)] pub fn register_sidecar_process( &self, run_id: i64, diff --git a/src-tauri/src/web_server.rs b/src-tauri/src/web_server.rs index 01a28436f..4b870cc98 100644 --- a/src-tauri/src/web_server.rs +++ b/src-tauri/src/web_server.rs @@ -233,17 +233,17 @@ async fn resume_claude_code() -> Json> { } /// Cancel Claude execution -async fn cancel_claude_execution(Path(sessionId): Path) -> Json> { +async fn cancel_claude_execution(Path(session_id): Path) -> Json> { // In web mode, we don't have a way to cancel the subprocess cleanly // The WebSocket closing should handle cleanup - println!("[TRACE] Cancel request for session: {}", sessionId); + println!("[TRACE] Cancel request for session: {}", session_id); Json(ApiResponse::success(())) } /// Get Claude session output -async fn get_claude_session_output(Path(sessionId): Path) -> Json> { +async fn get_claude_session_output(Path(session_id): Path) -> Json> { // In web mode, output is streamed via WebSocket, not stored - println!("[TRACE] Output request for session: {}", sessionId); + println!("[TRACE] Output request for session: {}", session_id); Json(ApiResponse::success( "Output available via WebSocket only".to_string(), ))