mirror of
https://github.com/tmux-plugins/tmux-resurrect.git
synced 2024-11-16 17:39:03 +00:00
70d78e8d73
Close #7
36 lines
665 B
Bash
Executable File
36 lines
665 B
Bash
Executable File
#!/usr/bin/env bash
|
|
|
|
CURRENT_DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"
|
|
|
|
source "$CURRENT_DIR/helpers.sh"
|
|
|
|
dump_format() {
|
|
local delimiter=$'\t'
|
|
local format
|
|
format+="#{session_name}"
|
|
format+="${delimiter}"
|
|
format+="#{window_index}"
|
|
format+="${delimiter}"
|
|
format+="#{window_name}"
|
|
format+="${delimiter}"
|
|
format+="#{pane_current_path}"
|
|
echo "$format"
|
|
}
|
|
|
|
dump() {
|
|
tmux list-panes -a -F "$(dump_format)"
|
|
}
|
|
|
|
save_all_sessions() {
|
|
local session_path="$(session_path)"
|
|
mkdir -p "$SESSIONS_DIR"
|
|
dump > $session_path
|
|
ln -fs "$session_path" "$(last_session_path)"
|
|
display_message "Saved all Tmux sessions!"
|
|
}
|
|
|
|
main() {
|
|
save_all_sessions
|
|
}
|
|
main
|