Repository navigation
Conversation
Setting a pane background with `tmux select-pane -t <pane> -P "bg=..."` changes the active pane and clears the window zoom flag as a side effect on tmux 3.x. Tinting a background agent's pane therefore unzooms the user's current window and steals focus to the triggering pane whenever a tracked agent changes state. Set the pane background through the pane-level `window-style` option instead. `set-option -p window-style` writes only the pane option and leaves the active pane and zoom untouched, so no focus restore is needed. Convert every set and clear site: apply_pane_style and reset_pane_style in agent-state.sh, both focus-in clear paths in pane-focus-in.sh, and the bulk reset loop in reset_all.sh, so a tint applied through window-style is also cleared through window-style.
hammondr
force-pushed
the
fix/pane-bg-window-style
branch
from
July 23, 2026 12:58
15b60ca to
fc8a680
Compare
Author
|
Closing as a duplicate of #6, which predates this by six weeks and makes the same change: pane background set through |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Problem
When an agent updates its state in a background pane (
needs-inputordone), the pane-background indicator unzooms the user's current window and moves focus to the triggering pane. Anyone who has zoomed one pane to concentrate on it loses that zoom whenever any other tracked pane changes state, and focus jumps away from where they were working.Root cause
apply_pane_styleandreset_pane_styleinscripts/agent-state.shset the pane background withtmux select-pane -t <pane> -P "bg=...". On tmux 3.x,select-pane -Ptargeting a non-active pane changes the active pane and clears the windowzoomedflag as a side effect, even when the only intent is to set a style. The functions then callselect-pane -t <previous-active>to put focus back, which restores the active pane but cannot restore the zoom.Reproduction on tmux 3.7b, starting from a zoomed 2-pane window:
The same side effect fires for every state that tints a background pane, so a long-running agent that finishes in a hidden pane yanks the user out of their zoom.
Fix
Set the pane background through the pane-level
window-styleoption instead ofselect-pane -P:set-option -pwrites only the pane option. It leaves the active pane and the zoom flag untouched, so no focus juggling or restore call is needed.This PR converts every set and clear site to
window-styleso a tint applied one way is cleared the same way:scripts/agent-state.sh:apply_pane_styleandreset_pane_stylescripts/pane-focus-in.sh: the two focus-in clear pathsscripts/reset_all.sh: the bulk reset loopVerification
Primitive, on tmux 3.7b, starting from a zoomed window:
End to end: a background pane transitioning to
donewhile another pane is zoomed keeps the zoom and the active pane, tints the background pane, and clears the tint when that pane is focused.Compatibility and scope
window-styleis a standard pane option in tmux 3.x, and bothselect-pane -Pandset-option -p window-styleset the pane background, so the rendered result is unchanged. The Knight Rider animation writes a status-bar frame index and does not color panes, so it is unaffected. The active-pane border, window-title styling, and status indicators useset-window-optionand status formats rather thanselect-pane, so they are unaffected as well.