From 2b259cf11ac2fa36ca8d9aef6c64cd624c91fbb9 Mon Sep 17 00:00:00 2001 From: Bruno Sutic Date: Fri, 29 Aug 2014 19:51:47 +0200 Subject: [PATCH] Show spinner during the env save process --- CHANGELOG.md | 1 + scripts/restore.sh | 2 +- scripts/save.sh | 5 ++++- scripts/spinner_helpers.sh | 2 +- 4 files changed, 7 insertions(+), 3 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index fa46320..9755e14 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,6 +1,7 @@ # Changelog ### master +- show spinner during the save process ### v0.4.0, 2014-08-29 - change plugin name to `tmux-resurrect`. Change all the variable names. diff --git a/scripts/restore.sh b/scripts/restore.sh index 8d24181..f915e1f 100755 --- a/scripts/restore.sh +++ b/scripts/restore.sh @@ -192,7 +192,7 @@ restore_active_and_alternate_sessions() { main() { if supported_tmux_version_ok && check_saved_session_exists; then - start_spinner + start_spinner "Restoring..." "Tmux restore complete!" restore_all_panes restore_pane_layout_for_each_window >/dev/null 2>&1 restore_all_pane_processes diff --git a/scripts/save.sh b/scripts/save.sh index 8be8082..1f9bb88 100755 --- a/scripts/save.sh +++ b/scripts/save.sh @@ -4,6 +4,7 @@ CURRENT_DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )" source "$CURRENT_DIR/scripts/variables.sh" source "$CURRENT_DIR/helpers.sh" +source "$CURRENT_DIR/spinner_helpers.sh" pane_format() { local delimiter=$'\t' @@ -96,12 +97,14 @@ save_all() { dump_windows >> $resurrect_file_path dump_state >> $resurrect_file_path ln -fs "$resurrect_file_path" "$(last_resurrect_file)" - display_message "Tmux environment saved!" } main() { if supported_tmux_version_ok; then + start_spinner "Saving..." "Tmux environment saved!" save_all + stop_spinner + display_message "Tmux environment saved!" fi } main diff --git a/scripts/spinner_helpers.sh b/scripts/spinner_helpers.sh index 2c04cf9..fe73cd7 100644 --- a/scripts/spinner_helpers.sh +++ b/scripts/spinner_helpers.sh @@ -1,5 +1,5 @@ start_spinner() { - $CURRENT_DIR/tmux_spinner.sh "Restoring tmux..." "Tmux restore complete!" & + $CURRENT_DIR/tmux_spinner.sh "$1" "$2" & export SPINNER_PID=$! }