tmux-resurrect/session_saver.tmux
2014-08-26 12:23:58 +02:00

34 lines
760 B
Bash
Executable File

#!/usr/bin/env bash
CURRENT_DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"
source "$CURRENT_DIR/scripts/helpers.sh"
default_save_key="M-s"
save_option="@session-saver-save"
default_restore_key="M-r"
restore_option="@session-saver-restore"
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/session_saver.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/session_restorer.sh"
done
}
main() {
set_save_bindings
set_restore_bindings
}
main