Skip KWin watcher if X11 is detectable

This commit is contained in:
Demmie 2023-11-04 21:46:36 -04:00
parent 451346901d
commit 8eed243593
No known key found for this signature in database
GPG Key ID: B06DAA3D432C6E9A

View File

@ -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 {