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

[Feature request] Ability to log every pane and window in a session with one keybind. #45

Open
0xpurecha0s opened this issue Mar 7, 2020 · 2 comments

Comments

@0xpurecha0s
Copy link

Thank you for this outstanding plugin.

Problem Description : Currently when I am about to end my session I manually loop through entire windows and panes in the session and manually type in Alt+Shift+P to create a new directory and save my logs in that directory which then saves this in the naming convention that suits my needs.

Proposition : If at all is it possible to create a key bind say Shift+Alt+S to save the entire logs of a session in one single go i.e to say it will iterate to all windows and panes in them and log them individually to the directory in which the tmux session was started ?

@majedchams
Copy link

I also need this feature. That would be a great improvement.
Thanks

@0xpurecha0s
Copy link
Author

I researched and found something. Unfortunately its not working as I desired it to work. Below is what I did. If somebody can enlighten me with what I am doing wrong.

  1. Created a new file save_complete_history_all_panes.sh in .tmux-logging/scripts
#!/usr/bin/env bash

CURRENT_DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"

source "$CURRENT_DIR/variables.sh"
source "$CURRENT_DIR/shared.sh"

main() {
	if supported_tmux_version_ok; then
		local file=$(expand_tmux_format_path "${save_complete_history_full_filename}")
		local history_limit="$(tmux display-message -p -F "#{history_limit}")"
		for _window in $(tmux list-windows -F '#I'); do
			for _pane in $(tmux list-panes -t ${_window} -F '#P'); do
				tmux capture-pane -J -S "-${history_limit}" -p > "${file}"
				display_message "History saved to ${file}"
			done
		done
	fi
}
main
  1. Create a new key-bind in .tmux-logging/scripts/variables.sh :
# Complete history capture in all panes.
default_save_complete_history_all_panes_key="M-S" # Alt+Shift+S
save_complete_history_all_panes_key=$(tmux show-option -gqv "@save-complete-history-all-panes")
save_complete_history_all_panes_key=${save_complete_history_all_panes_key:-$default_save_complete_history_all_panes_key}

I thought this should work. Logically speaking it definitely should unfortunately it only captures the pane the key-bind was pressed in. If someone can help/guide me what I am doing wrong. @majedchams @bruno-

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