hyprland-community / hyprland-rs

An unofficial rust wrapper for hyprland's IPC [maintainers=@yavko,@cyrinux]
Other
252 stars 55 forks source link

[BUG] can't read from socket: no such file #226

Closed jlo62 closed 5 months ago

jlo62 commented 5 months ago
thread 'main' panicked at /home/janluca/.cache/cargo/registry/src/index.crates.io-6f17d22bba15001f/hyprland-0.3.13/src/data/regular.rs:31:19:
A error occured while parsing the output from the hypr socket: IoError(Os { code: 2, kind: NotFound, message: "No such file or directory" })
note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace

my code:

fn hyprland()  -> hyprland::Result<()> {
    println!("hello");
    use hyprland::event_listener::EventListenerMutable as EventListener;
    let mut listener = EventListener::new();
    let mut event_listener = EventListener::new();

    event_listener.add_active_window_change_handler(|data, _| {
        println!("{data:#?}");
    });
    listener.add_workspace_change_handler(|id, _| println!("changed workspace to {id:?}"));
    event_listener.start_listener()?;
    Ok(())
}

I can run this, and then I get expected outputs: socat - "UNIX-CONNECT:$XDG_RUNTIME_DIR/hypr/$HYPRLAND_INSTANCE_SIGNATURE/.socket2.sock" (It's from the hyprland wiki)

yavko commented 5 months ago

Please check latest releases and PRs next time you make an issue, this has already been resolved by the 0.4.0-alpha.0 release