mirror of
https://github.com/tmux-plugins/tmux-resurrect.git
synced 2024-11-22 04:18:48 +00:00
Create a session saver script
This commit is contained in:
parent
651b14075a
commit
b0f5fe18d8
33
scripts/session_saver.sh
Executable file
33
scripts/session_saver.sh
Executable file
@ -0,0 +1,33 @@
|
||||
#!/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() {
|
||||
mkdir -p $HOME/.tmux
|
||||
dump > $HOME/.tmux/session
|
||||
display_message "Saved all Tmux sessions!"
|
||||
}
|
||||
|
||||
main() {
|
||||
save_all_sessions
|
||||
}
|
||||
main
|
Loading…
Reference in New Issue
Block a user