From 4d9c130fa4862a7b4821535bfb772a66fd892f95 Mon Sep 17 00:00:00 2001 From: 0xk1f0 Date: Wed, 8 May 2024 21:11:03 +0200 Subject: [PATCH] fix(hyprpaper): add proper fallback for non-hyprland envs --- src/integrations/hyprpaper.rs | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/src/integrations/hyprpaper.rs b/src/integrations/hyprpaper.rs index 85a0f6c..610d9ea 100644 --- a/src/integrations/hyprpaper.rs +++ b/src/integrations/hyprpaper.rs @@ -10,9 +10,13 @@ pub fn push(papers: &Vec) -> Result<(), String> { let socket_base = env::var("XDG_RUNTIME_DIR").unwrap_or_else(|_| { return format!("/run/user/{}", env::var("UID").unwrap()); }); - let instance_id = env::var("HYPRLAND_INSTANCE_SIGNATURE") - .map_err(|_| "no HYPRLAND_INSTANCE_SIGNATURE set")?; - let target_socket = format!("{}/hypr/{}/.hyprpaper.sock", socket_base, instance_id); + let instance_id = env::var("HYPRLAND_INSTANCE_SIGNATURE").unwrap_or("".to_string()); + let target_socket: String; + if instance_id.len() > 0 { + target_socket = format!("{}/hypr/{}/.hyprpaper.sock", socket_base, instance_id) + } else { + target_socket = format!("{}/hypr/.hyprpaper.sock", socket_base) + } // block till we can connect loop {