use std::fmt::Write as _; use crate::lib::ipc; use crate::Wallpapers; use std::env; pub fn change_wallpapers(wallpapers: &Wallpapers) { let hypr_session = env::var("HYPRLAND_INSTANCE_SIGNATURE").unwrap(); let xdg_path = env::var("XDG_RUNTIME_DIR").unwrap(); let mut socket_path = String::new(); write!(&mut socket_path, "{}/hypr/{}/.hyprpaper.sock", xdg_path, hypr_session).unwrap(); let ipc = ipc::IPC::new(socket_path); for monitor in wallpapers.config.monitors.monitors.iter() { let mut buf = String::new(); let x = wallpapers.random_selection(&monitor.ratio).to_string(); write!(&mut buf, "reload ,{}", x).unwrap(); ipc.clone().write(buf); // println!("{}", buf); } // println!("{}", ipc.write(String::from(""))) }