Improve initial plugin save delay

This commit is contained in:
Bruno Sutic 2015-02-20 00:53:42 +01:00
parent ab3e951cfa
commit 297e5b6993
No known key found for this signature in database
GPG Key ID: 66D96E4F2F7EF26C
2 changed files with 11 additions and 3 deletions

View File

@ -4,6 +4,8 @@
- do not auto-restore tmux environment if another tmux server is already running - do not auto-restore tmux environment if another tmux server is already running
(we don't want to duplicate stuff) (we don't want to duplicate stuff)
- bugfixes for 'tmux auto start' OS X Terminal.app and iTerm scripts - 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 ### v2.1.0, 2015-02-18
- enable "tmux auto start" for OS X - enable "tmux auto start" for OS X

View File

@ -16,6 +16,13 @@ handle_tmux_automatic_start() {
$CURRENT_DIR/scripts/handle_tmux_automatic_start.sh $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() { add_resurrect_save_interpolation() {
local status_right_value="$(get_tmux_option "status-right" "")" local status_right_value="$(get_tmux_option "status-right" "")"
local new_value="${save_command_interpolation}${status_right_value}" local new_value="${save_command_interpolation}${status_right_value}"
@ -37,9 +44,8 @@ main() {
if supported_tmux_version_ok; then if supported_tmux_version_ok; then
handle_tmux_automatic_start handle_tmux_automatic_start
# Don't start saving right after tmux is started. # give user a chance to restore previously saved session
# We wanna give user a chance to restore previous session. delay_saving_environment_on_first_plugin_load
set_last_save_timestamp
add_resurrect_save_interpolation add_resurrect_save_interpolation
if just_started_tmux_server; then if just_started_tmux_server; then