Skip to content

Automatically turn on logging for new panes #28

@prokaryont

Description

@prokaryont

Hi, thanks for the nice plugin!

I needed a way of automatically turning on logging for newly created panes. Especially when constructing sessions in detached mode. This was not possible with the original start_logging.sh because it always runs the command on the last selected pane.

The modified start_logging.sh takes a target pane parameter that allows to turn on logging for arbitrary panes.

If one puts a snippet like the following into .bashrc, logging gets automatically enabled for new panes.

if [ -n "$TMUX_PANE" ] && [ "$TMUX_PANE_AUTORUN" != "0" ]; then
  # set TMUX_LOGGING to the path of your tmux-logging installation.
  $TMUX_LOGGING/scripts/start_logging.sh "${log_file}" "${TMUX_PANE}"

  # Prevent autocommand in subshells. We only want the top shell within a
  # tmux pane to run these commands.
  export TMUX_PANE_AUTORUN=0
fi

Would you mind taking a look at the code and checking if it looks reasonable?
It works for me on kali with tmux 2.6-rc3.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions