all repos — dingger @ aa4d6fcd9eac0d0fe051d6307ed6009adefbb2e1

Watches the AI coding agents in your tmux panes on macOS and tells you which need you, from the menu bar, a floating panel, the status line and notifications; jumps to them, and restores tmux sessions and agents after a crash

fix clicks from the menu bar app: find tmux without homebrew on PATH

launchd starts the menu bar app with PATH=/usr/bin:/bin:/usr/sbin:/sbin,
so the `dingger focus` it runs for every click (panel rows, menu rows, the
jump shortcut) could not find homebrew's tmux and failed with a misleading
"no tmux client attached"; the app discarded the error. dingger now finds
tmux on PATH or in the usual install locations (DINGGER_TMUX overrides),
reports a missing tmux as such, and the app logs failed jumps.

also: panel rows own every click inside them (labels took the clicks and
counted as window-drag background).

e2e step 14 repeats the menu bar row click and dingger focus under
launchd's environment; both fail with the previous binaries.
Igor Soarez igor@soarez.org
Tue, 20 Oct 2026 15:01:18 +0300
commit

aa4d6fcd9eac0d0fe051d6307ed6009adefbb2e1

parent

eed9c9c1141e118e43b0055f935dd891d89bebd6

M crates/dinggerd/src/main.rs → crates/dinggerd/src/main.rs

@@ -125,7 +125,7 @@ /// Show a pane in a client and mark it attended (`@dingger_ack`, consumed

/// by the watcher on its next tick). This is the single code path behind /// every click: the tmux status line and the menu bar rows. fn focus(client: Option<String>, pane: Option<String>) -> Result<(), String> { - let clients = tmux::clients(); + let clients = tmux::clients()?; // The named client if it is attached; otherwise the most recently active // one (a click on the status line makes the clicking client the most // recent, so this is right even if the name did not expand).
M crates/dinggerd/src/tmux.rs → crates/dinggerd/src/tmux.rs

@@ -37,8 +37,30 @@ self.window_active && self.session_attached

} } +/// The tmux binary. launchd starts dingger, and the menu bar app that runs +/// `dingger focus`, with PATH=/usr/bin:/bin:/usr/sbin:/sbin, where Homebrew's +/// tmux is not found: fall back to the usual install locations. +fn tmux_binary() -> &'static std::path::Path { + static TMUX: std::sync::OnceLock<std::path::PathBuf> = std::sync::OnceLock::new(); + TMUX.get_or_init(|| { + if let Some(path) = std::env::var_os("DINGGER_TMUX") { + return path.into(); + } + let on_path: Vec<std::path::PathBuf> = std::env::var_os("PATH") + .map(|path| std::env::split_paths(&path).map(|dir| dir.join("tmux")).collect()) + .unwrap_or_default(); + let known = ["/opt/homebrew/bin/tmux", "/usr/local/bin/tmux", "/usr/bin/tmux"] + .map(std::path::PathBuf::from); + on_path + .into_iter() + .chain(known) + .find(|candidate| candidate.is_file()) + .unwrap_or_else(|| "tmux".into()) + }) +} + fn run_tmux(args: &[&str]) -> Result<String, String> { - let mut command = Command::new("tmux"); + let mut command = Command::new(tmux_binary()); // -u forces UTF-8 mode: without it, tmux mangles format output in // non-UTF-8 locales (launchd/cron default to the C locale, turning the // tab separators in our -F formats into underscores).

@@ -51,7 +73,7 @@ }

let output = command .args(args) .output() - .map_err(|err| format!("failed to run tmux: {err}"))?; + .map_err(|err| format!("failed to run tmux ({}): {err}", tmux_binary().display()))?; if !output.status.success() { let stderr = String::from_utf8_lossy(&output.stderr); return Err(format!("tmux {} failed: {}", args.join(" "), stderr.trim()));

@@ -227,14 +249,12 @@ .filter(|value| !value.is_empty())

} /// Attached clients as (name, pid), most recently active first. -pub fn clients() -> Vec<(String, u32)> { - let Ok(out) = run_tmux(&[ +pub fn clients() -> Result<Vec<(String, u32)>, String> { + let out = run_tmux(&[ "list-clients", "-F", "#{client_activity}\t#{client_name}\t#{client_pid}", - ]) else { - return Vec::new(); - }; + ])?; let mut clients: Vec<(u64, String, u32)> = out .lines() .filter_map(|line| {

@@ -246,7 +266,7 @@ Some((activity, name, pid))

}) .collect(); clients.sort_by_key(|client| std::cmp::Reverse(client.0)); - clients.into_iter().map(|(_, name, pid)| (name, pid)).collect() + Ok(clients.into_iter().map(|(_, name, pid)| (name, pid)).collect()) } /// Show a pane in a client: switch the client to the pane's window and make
M tests/e2e.sh → tests/e2e.sh

@@ -303,6 +303,30 @@ else

fail "menu bar binary not found at $MENUBAR" fi +# --- 14. clicks work with launchd's environment ------------------------------ +# launchd starts the menu bar app with PATH=/usr/bin:/bin:/usr/sbin:/sbin, +# which has no Homebrew tmux; every click runs `dingger focus` from there. +echo "14. launchd environment" +launchd_env() { + env -i HOME="$HOME" PATH=/usr/bin:/bin:/usr/sbin:/sbin DINGGER_TMUX_SOCKET="$SOCK" \ + DINGGER_AGENT_SOCKET="$HOOK" DINGGER_BIN="$DINGGER" "$@" +} +t switch-client -c "$CLIENT" -t "$B1" +expect "client back on wb1" "client_window" wb1 +hook "$A1" working; hook "$A1" idle +expect "A1 done" "opt $A1 @agent_state" done +if [ -x "$MENUBAR" ]; then + launchd_env "$MENUBAR" --click "$A1" 2>"$DIR/click.err" + expect "menu bar row click jumps, under launchd's PATH" "client_window" wa1 + expect "A1 idle after that click" "opt $A1 @agent_state" idle +fi +t switch-client -c "$CLIENT" -t "$B1" +expect "client back on wb1" "client_window" wb1 +hook "$A2" working; hook "$A2" idle +expect "A2 done" "opt $A2 @agent_state" done +launchd_env "$DINGGER" focus +expect "dingger focus (jump shortcut) jumps, under launchd's PATH" "client_window" wa2 + echo echo "$PASSES passed, $FAILS failed" [ "$FAILS" -eq 0 ] || { echo "--- daemon log tail"; tail -30 "$DIR/daemon.log"; exit 1; }