mirror of
https://github.com/tmux-plugins/tmux-resurrect.git
synced 2024-12-22 14:58:49 +00:00
parent
70d78e8d73
commit
5c2853a55f
@ -2,6 +2,7 @@
|
||||
|
||||
### master
|
||||
- saving a new session does not remove the previous one
|
||||
- make the directory where sessions are stored configurable
|
||||
|
||||
### v0.0.1, 2014-08-26
|
||||
- started a project
|
||||
|
@ -1,5 +1,6 @@
|
||||
# constants
|
||||
SESSIONS_DIR="$HOME/.tmux/sessions"
|
||||
# configurable constants
|
||||
default_sessions_dir="$HOME/.tmux/sessions"
|
||||
sessions_dir_option="@sessions-dir"
|
||||
|
||||
# helper functions
|
||||
get_tmux_option() {
|
||||
@ -38,11 +39,15 @@ display_message() {
|
||||
tmux set-option -gq display-time "$saved_display_time"
|
||||
}
|
||||
|
||||
sessions_dir() {
|
||||
echo $(get_tmux_option "$sessions_dir_option" "$default_sessions_dir")
|
||||
}
|
||||
|
||||
session_path() {
|
||||
local timestamp="$(date +"%Y-%m-%dT%H:%M:%S")"
|
||||
echo "${SESSIONS_DIR}/tmux_session_${timestamp}.txt"
|
||||
echo "$(sessions_dir)/tmux_session_${timestamp}.txt"
|
||||
}
|
||||
|
||||
last_session_path() {
|
||||
echo "${SESSIONS_DIR}/last"
|
||||
echo "$(sessions_dir)/last"
|
||||
}
|
||||
|
@ -23,7 +23,7 @@ dump() {
|
||||
|
||||
save_all_sessions() {
|
||||
local session_path="$(session_path)"
|
||||
mkdir -p "$SESSIONS_DIR"
|
||||
mkdir -p "$(sessions_dir)"
|
||||
dump > $session_path
|
||||
ln -fs "$session_path" "$(last_session_path)"
|
||||
display_message "Saved all Tmux sessions!"
|
||||
|
Loading…
Reference in New Issue
Block a user