From 8eed24359365035a05bb390f329e463ac7451bb7 Mon Sep 17 00:00:00 2001 From: Demmie <2e3s19@gmail.com> Date: Sat, 4 Nov 2023 21:46:36 -0400 Subject: [PATCH] Skip KWin watcher if X11 is detectable --- watchers/src/watchers/kwin_window.rs | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/watchers/src/watchers/kwin_window.rs b/watchers/src/watchers/kwin_window.rs index a4fcc1a..cfef167 100644 --- a/watchers/src/watchers/kwin_window.rs +++ b/watchers/src/watchers/kwin_window.rs @@ -7,7 +7,7 @@ use super::Watcher; use crate::report_client::ReportClient; use anyhow::{anyhow, Context}; use async_trait::async_trait; -use std::env::temp_dir; +use std::env::{self, temp_dir}; use std::path::Path; use std::sync::{mpsc::channel, Arc}; use std::thread; @@ -175,6 +175,12 @@ impl Watcher for WindowWatcher { debug!("KWin script is already loaded, unloading"); kwin_script.unload().await?; } + if env::var("WAYLAND_DISPLAY").is_err() + && env::var_os("XDG_SESSION_TYPE").unwrap_or("".into()) == "x11" + { + return Err(anyhow!("X11 should be tried instead")); + } + kwin_script.load().await.unwrap(); let active_window = Arc::new(Mutex::new(ActiveWindow {