fix: let active tmux clients control window size

Keep the global window-size=latest policy for linked web and iOS sessions so switching between phone and Mac sends SIGWINCH and reflows the shared pane.
This commit is contained in:
2026-07-28 23:53:01 +08:00
parent 998dfc9f8e
commit 76b2ac69f8

View File

@@ -44,14 +44,11 @@ tmux set-option -t "$tmp" mouse on
first="$(tmux display-message -p -t "$tmp" '#{window_index}')"
tmux link-window -k -s "$src" -t "$tmp:$first"
# A tmux window has a single size shared by every viewer. With the global
# "latest" policy a bigger local client cuts the browser view off, so pin this
# window to "smallest" while a web viewer is attached: the browser always sees
# the full content; a larger local client sees dotted padding instead.
tmux set-window-option -t "$src" window-size smallest
# A tmux window has one size shared by every viewer. Keep the global
# "window-size latest" policy so the most recently active Mac, web, or iOS
# client owns that size and full-screen programs receive SIGWINCH to reflow.
cleanup() {
tmux set-window-option -u -t "$src" window-size 2>/dev/null || true
tmux kill-session -t "$tmp" 2>/dev/null || true
}
trap cleanup EXIT HUP TERM INT