Skip to content

Commit

Permalink
Add logging to see retries on Gnome
Browse files Browse the repository at this point in the history
  • Loading branch information
2e3s committed Jan 24, 2024
1 parent c406b33 commit 847e976
Showing 1 changed file with 5 additions and 3 deletions.
8 changes: 5 additions & 3 deletions watchers/src/watchers/gnome_wayland.rs
Original file line number Diff line number Diff line change
Expand Up @@ -15,18 +15,20 @@ fn is_gnome() -> bool {

fn is_wayland() -> bool {
std::env::var("WAYLAND_DISPLAY").is_ok()
&& !std::env::var("XDG_SESSION_TYPE")
&& std::env::var("XDG_SESSION_TYPE")
.unwrap_or("".into())
.to_lowercase()
.contains("x11")
.contains("wayland")
}

pub async fn load_watcher<T: GnomeWatcher>() -> anyhow::Result<T> {
if is_gnome() && is_wayland() {
debug!("Gnome Wayland detected");
let mut watcher = Err(anyhow::anyhow!(""));
for _ in 0..3 {
watcher = T::load().await;
if watcher.is_err() {
if let Err(e) = &watcher {
debug!("Failed to load Gnome Wayland watcher: {e}");
tokio::time::sleep(tokio::time::Duration::from_secs(3)).await;
}
}
Expand Down

0 comments on commit 847e976

Please sign in to comment.