Skip to content

Commit

Permalink
Potentially fix on older hyprland versions
Browse files Browse the repository at this point in the history
  • Loading branch information
yavko committed May 1, 2024
1 parent 799de0d commit c600347
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions src/shared.rs
Original file line number Diff line number Diff line change
Expand Up @@ -334,7 +334,8 @@ fn init_socket_path(socket_type: SocketType) -> crate::Result<PathBuf> {
let mut p: PathBuf;
fn var_path() -> Option<PathBuf> {
if let Ok(runtime_path) = var("XDG_RUNTIME_DIR") {
let buf = PathBuf::from(runtime_path);
let mut buf = PathBuf::from(runtime_path);
buf.push("hypr");
if buf.exists() {
return Some(buf);
}
Expand All @@ -343,7 +344,8 @@ fn init_socket_path(socket_type: SocketType) -> crate::Result<PathBuf> {
}
fn uid_path() -> Option<PathBuf> {
if let Ok(uid) = var("UID") {
let buf = PathBuf::from("/run/user/".to_owned() + &uid);
let mut buf = PathBuf::from("/run/user/".to_owned() + &uid);
buf.push("hypr");
if buf.exists() {
return Some(buf);
}
Expand All @@ -353,10 +355,8 @@ fn init_socket_path(socket_type: SocketType) -> crate::Result<PathBuf> {

if let Some(path) = var_path() {
p = path;
p.push("hypr");
} else if let Some(path) = uid_path() {
p = path;
p.push("hypr");
} else if Path::new("/tmp/hypr").exists() {
p = PathBuf::from("/tmp/hypr");
} else {
Expand Down

0 comments on commit c600347

Please sign in to comment.