From 297e5b69932a3f64d330f54ede33f1a53342d800 Mon Sep 17 00:00:00 2001 From: Bruno Sutic Date: Fri, 20 Feb 2015 00:53:42 +0100 Subject: [PATCH] Improve initial plugin save delay --- CHANGELOG.md | 2 ++ resurrect_auto.tmux | 12 +++++++++--- 2 files changed, 11 insertions(+), 3 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index ecbed1a..f7161ba 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -4,6 +4,8 @@ - do not auto-restore tmux environment if another tmux server is already running (we don't want to duplicate stuff) - bugfixes for 'tmux auto start' OS X Terminal.app and iTerm scripts +- prevent saving for the first 15 minutes only when plugin is sourced the first + time (not on subsequent sources or tmux.conf reloads) ### v2.1.0, 2015-02-18 - enable "tmux auto start" for OS X diff --git a/resurrect_auto.tmux b/resurrect_auto.tmux index 9f508e3..514ea3c 100755 --- a/resurrect_auto.tmux +++ b/resurrect_auto.tmux @@ -16,6 +16,13 @@ handle_tmux_automatic_start() { $CURRENT_DIR/scripts/handle_tmux_automatic_start.sh } +delay_saving_environment_on_first_plugin_load() { + if [ -z "$(get_tmux_option "$last_auto_save_option" "")" ]; then + # last save option not set, this is first time plugin load + set_last_save_timestamp + fi +} + add_resurrect_save_interpolation() { local status_right_value="$(get_tmux_option "status-right" "")" local new_value="${save_command_interpolation}${status_right_value}" @@ -37,9 +44,8 @@ main() { if supported_tmux_version_ok; then handle_tmux_automatic_start - # Don't start saving right after tmux is started. - # We wanna give user a chance to restore previous session. - set_last_save_timestamp + # give user a chance to restore previously saved session + delay_saving_environment_on_first_plugin_load add_resurrect_save_interpolation if just_started_tmux_server; then