From f26fe0dce1fa3380b7ac998887cdc87c242058ae Mon Sep 17 00:00:00 2001 From: vpsone <84894255+vpsone@users.noreply.github.com> Date: Sat, 11 Apr 2026 06:55:24 +0530 Subject: [PATCH] Fix (linux) overlay problem in kde (#1121) * Fix overlay problem in kde * Add env variable check for GTK layer shell initialization --- src-tauri/src/overlay.rs | 16 ++++------------ 1 file changed, 4 insertions(+), 12 deletions(-) diff --git a/src-tauri/src/overlay.rs b/src-tauri/src/overlay.rs index 34cc315..7ac9852 100644 --- a/src-tauri/src/overlay.rs +++ b/src-tauri/src/overlay.rs @@ -17,6 +17,7 @@ use tauri_nspanel::{tauri_panel, CollectionBehavior, PanelBuilder, PanelLevel}; #[cfg(target_os = "linux")] use gtk_layer_shell::{Edge, KeyboardMode, Layer, LayerShell}; + #[cfg(target_os = "linux")] use std::env; @@ -69,18 +70,9 @@ fn update_gtk_layer_shell_anchors(overlay_window: &tauri::webview::WebviewWindow /// Returns true if layer shell was successfully initialized, false otherwise #[cfg(target_os = "linux")] fn init_gtk_layer_shell(overlay_window: &tauri::webview::WebviewWindow) -> bool { - // On KDE Wayland, layer-shell init has shown protocol instability. - // Fall back to regular always-on-top overlay behavior (as in v0.7.1). - let is_wayland = env::var("WAYLAND_DISPLAY").is_ok() - || env::var("XDG_SESSION_TYPE") - .map(|v| v.eq_ignore_ascii_case("wayland")) - .unwrap_or(false); - let is_kde = env::var("XDG_CURRENT_DESKTOP") - .map(|v| v.to_uppercase().contains("KDE")) - .unwrap_or(false) - || env::var("KDE_SESSION_VERSION").is_ok(); - if is_wayland && is_kde { - debug!("Skipping GTK layer shell init on KDE Wayland"); + + if env::var("HANDY_NO_GTK_LAYER_SHELL").is_ok() { + debug!("Skipping GTK layer shell init (HANDY_NO_GTK_LAYER_SHELL is set)"); return false; }