Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Automatically turn on logging for new panes #28

Open
prokaryont opened this issue Jul 23, 2018 · 1 comment
Open

Automatically turn on logging for new panes #28

prokaryont opened this issue Jul 23, 2018 · 1 comment

Comments

@prokaryont
Copy link

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.

@shmulkinator
Copy link

I wasn't able to get the above to work. Is there any other solution I might try?

tchinchow added a commit to tchinchow/tmux-logging that referenced this issue Jan 7, 2025
…to automatically turn on logging for new panes
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants