Merge 0cb1c3462c
into 100498d0c2
commit
ab6b339cec
|
@ -34,9 +34,26 @@ fetch_and_run_tmux_resurrect_save_script() {
|
|||
fi
|
||||
}
|
||||
|
||||
resurrect_dir() {
|
||||
local path="$(get_tmux_option "$resurrect_dir_option" "$default_resurrect_dir")"
|
||||
echo "${path/#\~/$HOME}" # expands tilde if used with @resurrect-dir
|
||||
}
|
||||
|
||||
delete_old_saves() {
|
||||
# check if @resurrect-dir was set - if so use it
|
||||
local resurrect_save_dir=$(resurrect_dir)
|
||||
find $resurrect_save_dir -type f -mtime +7 -name "tmux_resurrect_*.txt" -exec rm -f {} +
|
||||
}
|
||||
|
||||
main() {
|
||||
if supported_tmux_version_ok && auto_save_not_disabled && enough_time_since_last_run_passed; then
|
||||
fetch_and_run_tmux_resurrect_save_script
|
||||
|
||||
local keeping_old_saves=$(get_tmux_option "$keep_old_saves_option" "")
|
||||
if [ -z "$keeping_old_saves" ]
|
||||
then
|
||||
delete_old_saves
|
||||
fi
|
||||
fi
|
||||
}
|
||||
main
|
||||
|
|
|
@ -1,3 +1,8 @@
|
|||
# these variables should possibly be in scripts/variables.sh
|
||||
# but are currently here for consistency with tmux-resurrect
|
||||
default_resurrect_dir="$HOME/.tmux/resurrect"
|
||||
resurrect_dir_option="@resurrect-dir"
|
||||
|
||||
get_tmux_option() {
|
||||
local option="$1"
|
||||
local default_value="$2"
|
||||
|
|
|
@ -6,6 +6,7 @@ resurrect_restore_path_option="@resurrect-restore-script-path"
|
|||
|
||||
auto_save_interval_option="@continuum-save-interval"
|
||||
auto_save_interval_default="15"
|
||||
keep_old_saves_option="@continuum-keep-old-saves-option"
|
||||
|
||||
# time when the tmux environment was last saved (unix timestamp)
|
||||
last_auto_save_option="@continuum-save-last-timestamp"
|
||||
|
|
Loading…
Reference in New Issue