aboutsummaryrefslogtreecommitdiff
path: root/packaging
diff options
context:
space:
mode:
authorIgor Soarez <igor@soarez.org>2026-10-23 19:11:23 +0300
committerIgor Soarez <igor@soarez.org>2026-10-23 19:11:23 +0300
commite4d3bc242bd3d18aa83a76f25dcbe5cb7a2ced78 (patch)
tree70b7631a0558829fb53814f3fb5a1ad32977149f /packaging
parentb4f45632debe6b8dc2f44ca6cc1b003d9093ad33 (diff)
raise the terminal window that holds the tmux client
a jump (any click, a shortcut, search) activated the terminal app, which raised whichever window was used last. now: - the client: the named one (a status-line click), else one already on a session holding the agent's window (several terminal windows can show one session; it shows the agent without switching, and keeps its own session in a session group), else any; the focused one first, then the one used last (its last input or focus). - Ghostty (1.3+, scriptable by terminal id, not by tty): dingger learns which terminal holds each client when it gains focus. tmux's client-focus-in hook runs `dingger terminal focused`, which asks Ghostty for its focused terminal and records it in @dingger_terminal_<tty>, but only if the client is still focused once Ghostty answered (a fast switch must not pair the wrong terminal); a terminal holds one client, so an older pairing with it is dropped. `focus` raises the exact terminal (window, tab, split) through `tmux run-shell`: Apple Events from the tmux server count as Ghostty's own, so no permission prompt. a terminal that is gone is forgotten and the app activated, as without a pairing. - in a hook, #{client_name} can be another client (the previous event's); the snippet's hook uses #{hook_client}. e2e step 20: two nested clients on one session, focused by typing focus reports into their outer panes, a fake osascript as Ghostty, a fake open (tests never activate a real app); it loads the snippet's own hook line. each rule has a negative control that fails.
Diffstat (limited to 'packaging')
-rw-r--r--packaging/tmux/dingger.tmux6
1 files changed, 6 insertions, 0 deletions
diff --git a/packaging/tmux/dingger.tmux b/packaging/tmux/dingger.tmux
index f1529f1..b0b0951 100644
--- a/packaging/tmux/dingger.tmux
+++ b/packaging/tmux/dingger.tmux
@@ -18,3 +18,9 @@ bind -n MouseDown1StatusRight if -F '#{==:#{mouse_status_range},restore}' \
set-hook -g 'client-session-changed[77]' 'run-shell -b "$HOME/.local/bin/dingger poke"'
set-hook -g 'session-window-changed[77]' 'run-shell -b "$HOME/.local/bin/dingger poke"'
set-hook -g 'window-pane-changed[77]' 'run-shell -b "$HOME/.local/bin/dingger poke"'
+# When a terminal window gains focus, dingger learns which window holds this
+# client, so a jump raises exactly that window, tab, and split. Needs the
+# terminal's focus reports. (#{hook_client}: in a hook, #{client_name} may be
+# another client.)
+set -g focus-events on
+set-hook -g 'client-focus-in[77]' "run-shell -b \"$HOME/.local/bin/dingger terminal focused --client '#{hook_client}'\""