mirror of
https://github.com/2e3s/awatcher.git
synced 2025-06-06 11:35:46 +00:00
Add logging to see retries on Gnome
This commit is contained in:
parent
c406b335c5
commit
847e9767a0
@ -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;
|
||||
}
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user