Skip to content

Commit

Permalink
fix(hyprpaper): add proper fallback for non-hyprland envs
Browse files Browse the repository at this point in the history
  • Loading branch information
0xk1f0 committed May 8, 2024
1 parent 839527b commit 4d9c130
Showing 1 changed file with 7 additions and 3 deletions.
10 changes: 7 additions & 3 deletions src/integrations/hyprpaper.rs
Original file line number Diff line number Diff line change
Expand Up @@ -10,9 +10,13 @@ pub fn push(papers: &Vec<ResultPaper>) -> 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 {
Expand Down

0 comments on commit 4d9c130

Please sign in to comment.