mirror of
https://github.com/tmux-plugins/tmux-continuum.git
synced 2024-12-22 15:48:50 +00:00
Disable autosave when interval is set to 0
This commit is contained in:
parent
2e57be38e4
commit
aa01161701
@ -5,3 +5,4 @@
|
||||
- run the save script in the background
|
||||
- do not start saving right after tmux is started
|
||||
- add a check for tmux version to the initializer script
|
||||
- when interval is set to '0' autosave is disabled
|
||||
|
@ -6,9 +6,17 @@ source "$CURRENT_DIR/helpers.sh"
|
||||
source "$CURRENT_DIR/variables.sh"
|
||||
source "$CURRENT_DIR/shared.sh"
|
||||
|
||||
get_interval() {
|
||||
get_tmux_option "$auto_save_interval_option" "$auto_save_interval_default"
|
||||
}
|
||||
|
||||
auto_save_not_disabled() {
|
||||
[ "$(get_interval)" -gt 0 ]
|
||||
}
|
||||
|
||||
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")"
|
||||
local interval_minutes="$(get_interval)"
|
||||
local interval_seconds="$((interval_minutes * 60))"
|
||||
local next_run="$((last_saved_timestamp + $interval_seconds))"
|
||||
[ "$(current_timestamp)" -ge "$next_run" ]
|
||||
@ -23,7 +31,7 @@ fetch_and_run_tmux_resurrect_save_script() {
|
||||
}
|
||||
|
||||
main() {
|
||||
if supported_tmux_version_ok && enough_time_since_last_run_passed; then
|
||||
if supported_tmux_version_ok && auto_save_not_disabled && enough_time_since_last_run_passed; then
|
||||
fetch_and_run_tmux_resurrect_save_script
|
||||
fi
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user