Skip to content

Commit

Permalink
Skip KWin watcher if X11 is detectable
Browse files Browse the repository at this point in the history
  • Loading branch information
2e3s committed Nov 5, 2023
1 parent 4513469 commit efc0393
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion watchers/src/watchers/kwin_window.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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::{temp_dir, self};
use std::path::Path;
use std::sync::{mpsc::channel, Arc};
use std::thread;
Expand Down Expand Up @@ -175,6 +175,10 @@ 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 {
Expand Down

0 comments on commit efc0393

Please sign in to comment.