47 lines
1.4 KiB
Bash
Executable File
47 lines
1.4 KiB
Bash
Executable File
#!/usr/bin/env bash
|
|
|
|
SOURCE="${BASH_SOURCE[0]}"
|
|
while [ -h "$SOURCE" ]; do # resolve $SOURCE until the file is no longer a symlink
|
|
CURRENT_DIR="$( cd -P "$( dirname "$SOURCE" )" >/dev/null 2>&1 && pwd )"
|
|
SOURCE="$(readlink "$SOURCE")"
|
|
[[ $SOURCE != /* ]] && SOURCE="$DIR/$SOURCE" # if $SOURCE was a relative symlink, we need to resolve it relative to the path where the symlink file was located
|
|
done
|
|
CURRENT_DIR="$( cd -P "$( dirname "$SOURCE" )" >/dev/null 2>&1 && pwd )"
|
|
|
|
source "$CURRENT_DIR/scripts/variables.sh"
|
|
source "$CURRENT_DIR/scripts/helpers.sh"
|
|
|
|
set_save_bindings() {
|
|
local key_bindings=$(get_tmux_option "$save_option" "$default_save_key")
|
|
local key
|
|
for key in $key_bindings; do
|
|
tmux bind-key "$key" run-shell "$CURRENT_DIR/scripts/save.sh"
|
|
done
|
|
}
|
|
|
|
set_restore_bindings() {
|
|
local key_bindings=$(get_tmux_option "$restore_option" "$default_restore_key")
|
|
local key
|
|
for key in $key_bindings; do
|
|
tmux bind-key "$key" run-shell "$CURRENT_DIR/scripts/restore.sh"
|
|
done
|
|
}
|
|
|
|
set_default_strategies() {
|
|
tmux set-option -gq "${restore_process_strategy_option}irb" "default_strategy"
|
|
tmux set-option -gq "${restore_process_strategy_option}mosh-client" "default_strategy"
|
|
}
|
|
|
|
set_script_path_options() {
|
|
tmux set-option -gq "$save_path_option" "$CURRENT_DIR/scripts/save.sh"
|
|
tmux set-option -gq "$restore_path_option" "$CURRENT_DIR/scripts/restore.sh"
|
|
}
|
|
|
|
main() {
|
|
set_save_bindings
|
|
set_restore_bindings
|
|
set_default_strategies
|
|
set_script_path_options
|
|
}
|
|
main
|