mirror of
https://github.com/tmux-plugins/tmux-continuum.git
synced 2024-11-16 15:38:46 +00:00
83c5dd098d
minor correction on creating new session
34 lines
923 B
Bash
Executable File
34 lines
923 B
Bash
Executable File
#!/usr/bin/env bash
|
|
|
|
CURRENT_DIR="$( dirname "$0" )"
|
|
|
|
source "$CURRENT_DIR/helpers.sh"
|
|
source "$CURRENT_DIR/variables.sh"
|
|
|
|
start_tmux() {
|
|
local systemd_tmux_server_start_cmd="$(get_tmux_option "${systemd_tmux_server_start_cmd_option}" "${systemd_tmux_server_start_cmd_default}" )"
|
|
/usr/bin/tmux ${systemd_tmux_server_start_cmd}
|
|
}
|
|
|
|
clean_session() {
|
|
local sessions_count="$(tmux list-sessions 2>/dev/null | wc -l)"
|
|
|
|
if /usr/bin/tmux has-session -t "${tmux_server_session_temporary}"; then
|
|
# add a new session to preserve server daemon when killing temporary session
|
|
[ "${sessions_count}" = 1 ] && tmux new-session
|
|
|
|
# kill session
|
|
/usr/bin/tmux kill-session -t "${tmux_server_session_temporary}"
|
|
fi
|
|
}
|
|
|
|
main() {
|
|
start_tmux
|
|
|
|
# wait detached process of session restoration : start_auto_restore_in_background()
|
|
# with a sleep 1 inside fetch_and_run_tmux_resurrect_restore_script()
|
|
#sleep 1
|
|
|
|
clean_session
|
|
}
|
|
main |