mirror of
https://github.com/tmux-plugins/tmux-continuum.git
synced 2024-11-22 03:08:48 +00:00
Don't start continuous saving right after tmux is started
This commit is contained in:
parent
5ca7656df0
commit
2e40ecf4d0
@ -3,3 +3,4 @@
|
||||
### master
|
||||
- first working version
|
||||
- run the save script in the background
|
||||
- do not start saving right after tmux is started
|
||||
|
@ -2,7 +2,9 @@
|
||||
|
||||
CURRENT_DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"
|
||||
|
||||
source "$CURRENT_DIR/scripts/helpers.sh"
|
||||
source "$CURRENT_DIR/helpers.sh"
|
||||
source "$CURRENT_DIR/variables.sh"
|
||||
source "$CURRENT_DIR/shared.sh"
|
||||
|
||||
save_command_interpolation="#($CURRENT_DIR/scripts/resurrect_auto_save.sh)"
|
||||
|
||||
@ -13,6 +15,9 @@ add_resurrect_save_interpolation() {
|
||||
}
|
||||
|
||||
main() {
|
||||
# Don't start saving right after tmux is started.
|
||||
# We wanna give user a chance to restore previous session.
|
||||
set_last_save_timestamp
|
||||
add_resurrect_save_interpolation
|
||||
}
|
||||
main
|
||||
|
@ -4,19 +4,12 @@ CURRENT_DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"
|
||||
|
||||
source "$CURRENT_DIR/helpers.sh"
|
||||
source "$CURRENT_DIR/variables.sh"
|
||||
source "$CURRENT_DIR/shared.sh"
|
||||
|
||||
supported_tmux_version_ok() {
|
||||
$CURRENT_DIR/check_tmux_version.sh "$SUPPORTED_VERSION"
|
||||
}
|
||||
|
||||
current_timestamp() {
|
||||
echo "$(date +%s)"
|
||||
}
|
||||
|
||||
set_last_save_timestamp() {
|
||||
set_tmux_option "$last_auto_save_option" "$(current_timestamp)"
|
||||
}
|
||||
|
||||
enough_time_since_last_run_passed() {
|
||||
local last_saved_timestamp="$(get_tmux_option "$last_auto_save_option" "0")"
|
||||
local interval_minutes="$(get_tmux_option "$auto_save_interval_option" "$auto_save_interval_default")"
|
||||
|
7
scripts/shared.sh
Normal file
7
scripts/shared.sh
Normal file
@ -0,0 +1,7 @@
|
||||
current_timestamp() {
|
||||
echo "$(date +%s)"
|
||||
}
|
||||
|
||||
set_last_save_timestamp() {
|
||||
set_tmux_option "$last_auto_save_option" "$(current_timestamp)"
|
||||
}
|
Loading…
Reference in New Issue
Block a user