Skip to content

armgit / kanzo

Public Imported from GitHub
0

Self-hosted, sharable kanban for humans and agents. One 4.7 MB binary, 5 MB of RAM, 10 to 60 tokens per agent reply, starts in 3 ms, zero setup.

Open no browser on a machine without a display

emanuele-em45f4f69764af
diff --git a/src/web.rs b/src/web.rs
index ae8b07f..77a4f48 100644
--- a/src/web.rs
+++ b/src/web.rs
@@ -334,8 +334,15 @@ async fn is_kanzo(port: u16) -> bool {
}
fn open_browser(url: &str) {
- let opener = if cfg!(target_os = "macos") { "open" } else { "xdg-open" };
- if std::process::Command::new(opener).arg(url).spawn().is_err() {
+ if cfg!(target_os = "macos") {
+ if std::process::Command::new("open").arg(url).spawn().is_err() {
+ eprintln!("Open {url} in your browser.");
+ }
+ return;
+ }
+ // A board without a screen has nothing to open; the URL is already printed.
+ let desktop = ["DISPLAY", "WAYLAND_DISPLAY"].iter().any(|v| std::env::var_os(v).is_some_and(|v| !v.is_empty()));
+ if desktop && std::process::Command::new("xdg-open").arg(url).spawn().is_err() {
eprintln!("Open {url} in your browser.");
}
}