diff options
| author | Igor Soarez <igor@soarez.org> | 2026-10-25 07:44:25 +0200 |
|---|---|---|
| committer | Igor Soarez <igor@soarez.org> | 2026-10-25 07:44:25 +0200 |
| commit | 5d7ed0172366eef885fd490136e8b826a9722339 (patch) | |
| tree | 26e7bcb2b21d190072b66e3349a14cbdf8382a62 /crates/dinggerd/src/tmux.rs | |
| parent | 5fe10900102bb2e083f41ccafff25c4b3e378cd8 (diff) | |
terminal commands are silent when tmux runs them
tmux shows a hook's output and a non-zero exit in view mode over the pane.
the focus hook's normal outcomes (focus moved on, Ghostty not in front)
exited 1, and the one-second settling made "focus moved on" common:
"'dingger terminal focused --client ...' returned 1" kept covering panes.
`dingger terminal focused` and `terminal raise` now always exit 0 and
print nothing unless run by hand.
tmux::client_format checks that tmux answered for the client asked about:
for a client that is gone, tmux answers for the current one, so a raise
for a client that had just detached raised another client's terminal.
e2e step 20: no pane in view mode after the hook's failures, a gone
client raises nothing, and a focus held past the settling second; the old
code fails the new checks.
Diffstat (limited to 'crates/dinggerd/src/tmux.rs')
| -rw-r--r-- | crates/dinggerd/src/tmux.rs | 10 |
1 files changed, 6 insertions, 4 deletions
diff --git a/crates/dinggerd/src/tmux.rs b/crates/dinggerd/src/tmux.rs index 54da39d..f69acd1 100644 --- a/crates/dinggerd/src/tmux.rs +++ b/crates/dinggerd/src/tmux.rs @@ -274,10 +274,12 @@ pub fn pane_format(pane_id: &str, format: &str) -> Option<String> { /// Expand a format in the context of a client (its current pane/window). pub fn client_format(client: &str, format: &str) -> Option<String> { - run_tmux(&["display-message", "-p", "-c", client, format]) - .ok() - .map(|value| value.trim().to_string()) - .filter(|value| !value.is_empty()) + // For a client that is gone, tmux answers for the current one instead: + // the answer names its client, and must name this one. + let out = run_tmux(&["display-message", "-p", "-c", client, &format!("#{{client_name}}\t{format}")]).ok()?; + let (name, value) = out.trim_end_matches('\n').split_once('\t')?; + let value = value.trim(); + (name == client && !value.is_empty()).then(|| value.to_string()) } /// The sessions holding a pane's window (several: a session group, a linked |
