Migrate config load/save to bread_utils::tomlcfg; timeout-guard hyprctl calls
config.rs's config_dir/load_doc/save_doc/atomic_write were a byte-for-byte copy of bos-settings/src/config/mod.rs's versions (own doc comment said as much) introduced in the same fix pass that added them there — now both delegate to bread_utils::tomlcfg/bread_utils::atomic instead of each carrying their own copy (path dependency for now, see the TODO in Cargo.toml). Also: services/hyprland.rs::query_json used a bare Command::output() with no timeout, so an unresponsive hyprctl (Hyprland wedged/reloading) could block clients()/monitors()/layers() indefinitely — switched to bread_utils::proc::run_json with a 3s cap. Builds clean; all 8 existing tests pass.
This commit is contained in:
parent
df7f51281a
commit
7b7fe680fe
4 changed files with 33 additions and 59 deletions
|
|
@ -46,8 +46,9 @@ pub struct LayerClient {
|
|||
}
|
||||
|
||||
fn query_json(cmd: &str) -> Option<serde_json::Value> {
|
||||
let output = Command::new("hyprctl").args(["-j", cmd]).output().ok()?;
|
||||
output.status.success().then(|| serde_json::from_slice(&output.stdout).ok()).flatten()
|
||||
// Timeout-guarded: an unresponsive hyprctl (Hyprland wedged/reloading)
|
||||
// used to be able to block clients()/monitors()/layers() indefinitely.
|
||||
bread_utils::proc::run_json("hyprctl", &["-j", cmd], std::time::Duration::from_secs(3))
|
||||
}
|
||||
|
||||
pub fn clients() -> Vec<Client> {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue