Skip to content

Hyprpaper IPC hang #360

@snoweider

Description

@snoweider

Commands sent to hyprpaper IPC hang for me because the stream.read_to_end functions in instance.rs wait for an EOF that is never sent by the socket.

For example, I couldn't get this to write anything

match hyprpaper(Keyword::ListActive) {
        Ok(response) => match response {
            Response::ActiveWallpapers(wallpapers) => {
                for wallpaper in wallpapers {
                    println!("active wallpaper: {}", wallpaper.wallpaper_path);
                }
            }
            _ => println!("Unexpected response!"),
        },
        Err(e) => println!("Error: {e}"),
 }

Using something like this in instance.rs fixed it for me

use std::io::{Read, Write};
let mut stream = std::os::unix::net::UnixStream::connect(&self.hyprpaper_stream)?;
stream.write_all(content.data.as_bytes())?;

let mut buffer = [0u8; 8192];
let n = stream.read(&mut buffer[..])?;
let response = String::from_utf8(buffer[..n].to_vec())?;
Ok(response)

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions