Enable auto load

This commit is contained in:
Bruno Sutic
2015-02-15 14:36:06 +01:00
parent da2cc780d5
commit 99658eda98
4 changed files with 48 additions and 0 deletions

View File

@ -0,0 +1,27 @@
#!/usr/bin/env bash
CURRENT_DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"
source "$CURRENT_DIR/helpers.sh"
source "$CURRENT_DIR/variables.sh"
auto_restore_not_disabled() {
local auto_restore_value="$(get_tmux_option "$auto_restore_option" "$auto_restore_default")"
[ "$auto_restore_value" == "on" ] && [ ! -f "$auto_restore_halt_file" ]
}
fetch_and_run_tmux_resurrect_restore_script() {
# give tmux some time to start and source all the plugins
sleep 1
local resurrect_restore_script_path="$(get_tmux_option "$resurrect_restore_path_option" "")"
if [ -n "$resurrect_restore_script_path" ]; then
"$resurrect_restore_script_path"
fi
}
main() {
if auto_restore_not_disabled; then
fetch_and_run_tmux_resurrect_restore_script
fi
}
main

View File

@ -9,3 +9,8 @@ auto_save_interval_option="@resurrect-auto-save-interval"
# time when the tmux environment was last saved (unix timestamp)
last_auto_save_option="@resurrect-auto-save-last-timestamp"
auto_restore_option="@resurrect-auto-restore"
auto_restore_default="off"
auto_restore_halt_file="${HOME}/tmux_no_auto_restore"