Skip to content

Commit

Permalink
chore: Add check for acpid service
Browse files Browse the repository at this point in the history
  • Loading branch information
DashieTM committed May 23, 2024
1 parent 9f9e913 commit 8d07dbd
Showing 1 changed file with 8 additions and 2 deletions.
10 changes: 8 additions & 2 deletions src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -405,8 +405,14 @@ impl HyprDock {
}

pub fn socket_connect(&self) {
let mut sock =
UnixStream::connect("/var/run/acpid.socket").expect("failed to connect to socket");
let sock = UnixStream::connect("/var/run/acpid.socket");
if sock.is_err() {
println!(
"Could not connect to acpid socket, do you have the service installed and running?"
);
return;
}
let mut sock = sock.unwrap();
loop {
let mut buf = [0; 1024];
let n = sock.read(&mut buf).expect("failed to read from socket");
Expand Down

0 comments on commit 8d07dbd

Please sign in to comment.