From 041d927b00d83d4cd1d8d8a94266e75479778547 Mon Sep 17 00:00:00 2001 From: Breadway Date: Fri, 17 Jul 2026 09:55:45 +0800 Subject: [PATCH] Timeout-guard the hyprctl monitors query get_live_monitors used a bare Command::new("hyprctl").output() with no timeout. Switched to bread_utils::proc::run_json, now that this crate already depends on bread-utils (added in the config-migration commit). --- src/ui/views/hyprland.rs | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/src/ui/views/hyprland.rs b/src/ui/views/hyprland.rs index e0936d5..719ae27 100644 --- a/src/ui/views/hyprland.rs +++ b/src/ui/views/hyprland.rs @@ -69,11 +69,13 @@ fn save(rules: &[MonitorRule]) -> std::io::Result<()> { } fn get_live_monitors() -> Vec<(String, String)> { - let Ok(output) = std::process::Command::new("hyprctl").args(["monitors", "-j"]).output() else { + // Was a bare Command::new("hyprctl").output() with no timeout. + let Some(value) = + bread_utils::proc::run_json("hyprctl", &["monitors", "-j"], std::time::Duration::from_secs(3)) + else { return Vec::new(); }; - let text = String::from_utf8_lossy(&output.stdout); - let Ok(monitors) = serde_json::from_str::>(&text) else { + let Ok(monitors) = serde_json::from_value::>(value) else { return Vec::new(); }; monitors