Skip to content

Commit 3d96b64

Browse files
committed
fix: avoid blank tauri window on linux
1 parent 816b2a5 commit 3d96b64

1 file changed

Lines changed: 10 additions & 2 deletions

File tree

src-tauri/src/main.rs

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -616,8 +616,16 @@ fn main() {
616616
let (output_tx, mut output_rx) = mpsc::unbounded_channel::<TerminalOutput>();
617617
let (file_event_tx, mut file_event_rx) = mpsc::unbounded_channel::<FileEvent>();
618618

619-
// Enable GPU acceleration
620-
std::env::set_var("WEBKIT_DISABLE_COMPOSITING_MODE", "0");
619+
// Linux desktop sessions can show a blank/white window when WebKit compositing
620+
// is forced on under some Wayland/XWayland setups. Respect any explicit user
621+
// override and otherwise prefer the safer default on Linux.
622+
if std::env::var_os("WEBKIT_DISABLE_COMPOSITING_MODE").is_none() {
623+
#[cfg(target_os = "linux")]
624+
std::env::set_var("WEBKIT_DISABLE_COMPOSITING_MODE", "1");
625+
626+
#[cfg(not(target_os = "linux"))]
627+
std::env::set_var("WEBKIT_DISABLE_COMPOSITING_MODE", "0");
628+
}
621629

622630
tauri::Builder::default()
623631
.plugin(tauri_plugin_shell::init())

0 commit comments

Comments
 (0)