Long-running commands in a background tmux window can finish without drawing attention when the current window stays quiet. Activity monitoring marks a window after new output arrives while another window is selected, so the status line shows which background job needs attention before switching back.

Tmux treats monitor-activity as a window option. Setting it globally makes windows that inherit the global option raise an activity alert, and visual-activity controls whether tmux also shows a message for that alert instead of only marking the window list.

Activity alerts are cleared when the flagged window becomes current. Enable the setting in sessions where background output means a job finished, a log changed, or a build printed an error. Noisy commands can keep raising alerts, so verify the change by forcing output in a temporary background window before relying on it for real work.

Steps to enable tmux activity monitoring:

  1. Open the tmux config file used by the running server.
    $ vi ~/.tmux.conf

    tmux also reads $XDG_CONFIG_HOME/tmux/tmux.conf or ~/.config/tmux/tmux.conf when those paths are used instead of ~/.tmux.conf.

  2. Add the activity monitoring settings.
    set-window-option -g monitor-activity on
    set-option -g visual-activity on

    monitor-activity marks windows after background output. visual-activity makes tmux show an activity message as well as the status-line marker.

  3. Save the file and return to the shell prompt.
  4. Reload the config into the active tmux server.
    $ tmux source-file ~/.tmux.conf

    No output means tmux accepted the file and applied the settings to the running server. Use the same config path here when you edited an XDG tmux.conf file instead of ~/.tmux.conf.

  5. Confirm that global window activity monitoring is enabled.
    $ tmux show-options -gw monitor-activity
    monitor-activity on

    The -w flag checks the window-option layer, and -g checks the global value inherited by windows without a local override.

  6. Confirm that activity messages are enabled.
    $ tmux show-options -g visual-activity
    visual-activity on
  7. Create a temporary background window that produces output.
    $ tmux new-window -d -n activity-test 'sleep 5; echo activity check; sleep 300'

    The -d flag keeps the current window selected, so the temporary window is in the background when its output appears.

  8. Check the activity flag on the temporary window.
    $ tmux display-message -p -t :activity-test '#{window_activity_flag}'
    1

    1 means tmux recorded activity for that window. The window list also shows a # activity marker and uses the activity style until the window becomes current.

  9. Remove the temporary activity test window.
    $ tmux kill-window -t :activity-test