Skip to content

Commit 9ec4f18

Browse files
boeserwolfcjpaisBastian (BaM)
authored
fix(linux): improve Wayland startup stability (#769)
* feat: add configurable custom audio feedback sounds * fix(linux): improve Wayland startup stability * add dep for layer shell * fix(linux): avoid layer-shell init on KDE Wayland * chore(linux): realign startup-fix branch with main baseline * fix(linux): avoid layer-shell init on KDE Wayland --------- Co-authored-by: CJ Pais <cj@cjpais.com> Co-authored-by: Bastian (BaM) <git@noxware.de>
1 parent cba3b71 commit 9ec4f18

1 file changed

Lines changed: 17 additions & 0 deletions

File tree

src-tauri/src/overlay.rs

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,8 @@ use tauri_nspanel::{tauri_panel, CollectionBehavior, PanelBuilder, PanelLevel};
1717

1818
#[cfg(target_os = "linux")]
1919
use gtk_layer_shell::{Edge, KeyboardMode, Layer, LayerShell};
20+
#[cfg(target_os = "linux")]
21+
use std::env;
2022

2123
#[cfg(target_os = "macos")]
2224
tauri_panel! {
@@ -67,6 +69,21 @@ fn update_gtk_layer_shell_anchors(overlay_window: &tauri::webview::WebviewWindow
6769
/// Returns true if layer shell was successfully initialized, false otherwise
6870
#[cfg(target_os = "linux")]
6971
fn init_gtk_layer_shell(overlay_window: &tauri::webview::WebviewWindow) -> bool {
72+
// On KDE Wayland, layer-shell init has shown protocol instability.
73+
// Fall back to regular always-on-top overlay behavior (as in v0.7.1).
74+
let is_wayland = env::var("WAYLAND_DISPLAY").is_ok()
75+
|| env::var("XDG_SESSION_TYPE")
76+
.map(|v| v.eq_ignore_ascii_case("wayland"))
77+
.unwrap_or(false);
78+
let is_kde = env::var("XDG_CURRENT_DESKTOP")
79+
.map(|v| v.to_uppercase().contains("KDE"))
80+
.unwrap_or(false)
81+
|| env::var("KDE_SESSION_VERSION").is_ok();
82+
if is_wayland && is_kde {
83+
debug!("Skipping GTK layer shell init on KDE Wayland");
84+
return false;
85+
}
86+
7087
if !gtk_layer_shell::is_supported() {
7188
return false;
7289
}

0 commit comments

Comments
 (0)