Show spinner during the env save process

This commit is contained in:
Bruno Sutic 2014-08-29 19:51:47 +02:00
parent f9ad59900a
commit 2b259cf11a
No known key found for this signature in database
GPG Key ID: 66D96E4F2F7EF26C
4 changed files with 7 additions and 3 deletions

View File

@ -1,6 +1,7 @@
# Changelog # Changelog
### master ### master
- show spinner during the save process
### v0.4.0, 2014-08-29 ### v0.4.0, 2014-08-29
- change plugin name to `tmux-resurrect`. Change all the variable names. - change plugin name to `tmux-resurrect`. Change all the variable names.

View File

@ -192,7 +192,7 @@ restore_active_and_alternate_sessions() {
main() { main() {
if supported_tmux_version_ok && check_saved_session_exists; then if supported_tmux_version_ok && check_saved_session_exists; then
start_spinner start_spinner "Restoring..." "Tmux restore complete!"
restore_all_panes restore_all_panes
restore_pane_layout_for_each_window >/dev/null 2>&1 restore_pane_layout_for_each_window >/dev/null 2>&1
restore_all_pane_processes restore_all_pane_processes

View File

@ -4,6 +4,7 @@ CURRENT_DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"
source "$CURRENT_DIR/scripts/variables.sh" source "$CURRENT_DIR/scripts/variables.sh"
source "$CURRENT_DIR/helpers.sh" source "$CURRENT_DIR/helpers.sh"
source "$CURRENT_DIR/spinner_helpers.sh"
pane_format() { pane_format() {
local delimiter=$'\t' local delimiter=$'\t'
@ -96,12 +97,14 @@ save_all() {
dump_windows >> $resurrect_file_path dump_windows >> $resurrect_file_path
dump_state >> $resurrect_file_path dump_state >> $resurrect_file_path
ln -fs "$resurrect_file_path" "$(last_resurrect_file)" ln -fs "$resurrect_file_path" "$(last_resurrect_file)"
display_message "Tmux environment saved!"
} }
main() { main() {
if supported_tmux_version_ok; then if supported_tmux_version_ok; then
start_spinner "Saving..." "Tmux environment saved!"
save_all save_all
stop_spinner
display_message "Tmux environment saved!"
fi fi
} }
main main

View File

@ -1,5 +1,5 @@
start_spinner() { start_spinner() {
$CURRENT_DIR/tmux_spinner.sh "Restoring tmux..." "Tmux restore complete!" & $CURRENT_DIR/tmux_spinner.sh "$1" "$2" &
export SPINNER_PID=$! export SPINNER_PID=$!
} }