Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
22 changes: 22 additions & 0 deletions scripts/continuum_save.sh
Original file line number Diff line number Diff line change
Expand Up @@ -34,9 +34,31 @@ fetch_and_run_tmux_resurrect_save_script() {
fi
}

output_current_continuum_status() {
save_int=$(get_tmux_option "$auto_save_interval_option" | sed "s/[^0-9]*\([0-9]\+\).*/\1/")
status=""
if [ $save_int -eq 0 ]
then
status="#[fg=yellow]off#[fg=white]"
elif [ $save_int -gt 0 ]
then
status="#[fg=green,bold]"${save_int}"#[fg=white,nobold]"
else
status="#[fg=red]error#[fg=white]"
fi
local temp="#[fg=green,bold]"${save_int}"#[fg=white,nobold]"
echo " "${status}" "
}

main() {
if supported_tmux_version_ok && auto_save_not_disabled && enough_time_since_last_run_passed; then
fetch_and_run_tmux_resurrect_save_script
fi

# if user has enabled show status option then insert into statusline
if [ -n $(get_tmux_option "$show_continuum_status_option" "") ]
then
output_current_continuum_status
fi
}
main
1 change: 1 addition & 0 deletions scripts/variables.sh
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ resurrect_restore_path_option="@resurrect-restore-script-path"

auto_save_interval_option="@continuum-save-interval"
auto_save_interval_default="15"
show_continuum_status_option="@continuum-show-status-option"

# time when the tmux environment was last saved (unix timestamp)
last_auto_save_option="@continuum-save-last-timestamp"
Expand Down