mirror of
https://github.com/tmux-plugins/tmux-resurrect.git
synced 2025-09-02 04:26:59 +00:00
Save and restore hooks
This commit is contained in:

committed by
Ash Berlin-Taylor

parent
42f77b303c
commit
0133c7a96a
@ -148,3 +148,14 @@ resurrect_history_file() {
|
||||
local shell_name="$2"
|
||||
echo "$(resurrect_dir)/${shell_name}_history-${pane_id}"
|
||||
}
|
||||
|
||||
# hook helpers
|
||||
|
||||
save_hook() {
|
||||
get_tmux_option "$save_hook_option" "$save_hook_default"
|
||||
}
|
||||
|
||||
restore_hook() {
|
||||
get_tmux_option "$restore_hook_option" "$restore_hook_default"
|
||||
}
|
||||
|
||||
|
@ -344,6 +344,9 @@ restore_active_and_alternate_sessions() {
|
||||
main() {
|
||||
if supported_tmux_version_ok && check_saved_session_exists; then
|
||||
start_spinner "Restoring..." "Tmux restore complete!"
|
||||
if [ -n "$(restore_hook)" ]; then
|
||||
eval "$(restore_hook)"
|
||||
fi
|
||||
restore_all_panes
|
||||
restore_pane_layout_for_each_window >/dev/null 2>&1
|
||||
if save_shell_history_option_on; then
|
||||
|
@ -314,6 +314,9 @@ main() {
|
||||
stop_spinner
|
||||
display_message "Tmux environment saved!"
|
||||
fi
|
||||
if [ -n "$(save_hook)" ]; then
|
||||
eval "$(save_hook)"
|
||||
fi
|
||||
fi
|
||||
}
|
||||
main
|
||||
|
@ -42,3 +42,9 @@ shell_history_option="@resurrect-save-shell-history"
|
||||
|
||||
# set to 'on' to ensure panes are never ever overwritten
|
||||
overwrite_option="@resurrect-never-overwrite"
|
||||
|
||||
# Hooks
|
||||
restore_hook_default=""
|
||||
restore_hook_option="@resurrect-restore-hook"
|
||||
save_hook_default=""
|
||||
save_hook_option="@resurrect-save-hook"
|
||||
|
Reference in New Issue
Block a user