Add logging to see retries on Gnome

This commit is contained in:
Demmie 2024-01-24 01:13:35 -05:00
parent c406b335c5
commit 847e9767a0
No known key found for this signature in database
GPG Key ID: B06DAA3D432C6E9A

View File

@ -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;
}
}