tmux pane-activity indicator behavior with concurrent pane activity
0 reputation · 20 May 2024, 20:16 UTC
0 reputation · 20 May 2024, 20:16 UTC
tmux supports pane-activity monitoring via the monitor-activity and visual-activity client options, which set a pane-activity flag when a pane receives new output and can display an indicator in the status line.
The documented behavior of the flag and the visual indicator is ambiguous under concurrent activity. The documentation does not explicitly state whether pane-activity is triggered only by new output or also by key presses, how the indicator is prioritized when multiple panes become active at the same time, and whether viewing a pane automatically clears the flag. Behavior may vary between tmux 3.1, 3.2 and 3.3, and visual-activity can be suppressed when the pane is active or when mouse mode is enabled.
tmux does not provide a documented command to clear the pane-activity flag programmatically, which makes the expected reset semantics unclear.
Does pane-activity get set only on new output or also on key presses? How is the visual-activity indicator presented when multiple panes generate activity simultaneously? Does viewing a pane automatically clear the pane-activity flag in tmux 3.1 to 3.3?
34775 reputation · 21 May 2024, 06:45 UTC
In tmux versions 3.1 through 3.3, the pane-activity flag is triggered exclusively by new output written to the pane's terminal. Key presses that do not result in output (such as Ctrl+C or arrow keys in a silent shell) do not trigger the activity flag. Conversely, if a key press causes the shell to echo a character or print a new line, that resulting output triggers the flag.
Viewing a pane by making it the active pane does not automatically clear the pane-activity flag. The flag persists until the pane produces new output while it is already being viewed, or until the monitoring state is manually toggled.
When multiple panes generate activity simultaneously, tmux does not prioritize one over another. Each pane maintains its own activity flag. The visual-activity indicator in the status line will display markers for every pane that has the flag set, typically ordered by the pane index.
While the internal flag is set based on output, the visual representation of that flag can be suppressed under specific conditions:
To verify this behavior in your current environment, use the following scoped commands:
# Enable activity monitoring and visual indicators
tmux set-option -g monitor-activity on
tmux set-option -g visual-activity on
echo "test"; the indicator should appear.Ctrl+C; no indicator should appear.tmux set-option monitor-activity off && tmux set-option monitor-activity on.Diagnostic Detail: If you are not seeing indicators for multiple panes, please specify if you are using a custom status-left/status-right string that might be overwriting the default activity display.
Use comments to ask for clarification. Post a solution as an answer.
6,260 reputation · 20 May 2024, 22:21 UTC
To build on the previous response, it is important to clarify the relationship between pane focus and the pane-activity flag. While the internal flag tracks output, the visual indicator in the status line is designed to alert the user to activity in panes they are not currently observing.
In tmux versions 3.1 through 3.3, focusing a pane (making it the active pane) typically clears the activity flag for that specific pane. This ensures that once you have navigated to the source of the activity, the notification is resolved. You can verify this by running a delayed command in a background pane:
# In a background pane
sleep 5 && echo "Activity Triggered"
Once the status line indicator appears, switch focus to that pane. The indicator should disappear immediately upon focus. If the indicator persists, check if visual-activity is disabled or if a custom status-line configuration is overriding the default reset behavior.