Timeout-guard hyprctl JSON queries

hyprctl_json used a bare Command::new("hyprctl").output() with no timeout,
used by every geometry_* helper (region/output/window/active_window/
active_output selection) — an unresponsive hyprctl could block screenshot
capture indefinitely. Switched to bread_utils::proc::run_json (path
dependency for now, see the TODO in Cargo.toml).

grim/slurp/wl-copy calls deliberately left untouched: several pipe binary
image data through stdin/stdout (e.g. grim -> wl-copy), which
bread_utils::proc's current run_with_stdin only accepts as &str — adapting
those safely would need a bytes-flavored variant, out of scope for this
pass to avoid risking a regression in image piping.
This commit is contained in:
Breadway 2026-07-17 09:53:54 +08:00
parent 08c27d1b22
commit 5e4cbc83c9
3 changed files with 15 additions and 6 deletions

10
Cargo.lock generated
View file

@ -82,11 +82,21 @@ version = "1.5.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "f2032f911046de80f0a198e0901378627c33f59ea0ac00e363d481118bd70a53"
[[package]]
name = "bread-utils"
version = "0.2.3"
dependencies = [
"dirs",
"serde",
"serde_json",
]
[[package]]
name = "breadshot"
version = "0.1.0"
dependencies = [
"anyhow",
"bread-utils",
"chrono",
"clap",
"dirs",