tmux-continuum
tmux-continuum copied to clipboard
Systemd: Modifications to remove new session after restoration
The purpose of this modification is to allow session restoration on linux: the way are to :
- Create a labeled session "${tmux_server_session_temporary}" on start of tmux daemon
Let plugin script "restore.sh" restore tmux session
- Clean restored session by remove the temporary session "${tmux_server_session_temporary}" which having served to load the tmux daemon
After the start of tmux daemon, start simply tmux with the following command in a terminal console :
tmux a / attach / attach-session
or automate the start of tmux in terminal with adding line to the .basrhrc user file:
type tmux &>/dev/null && tmux ls &>/dev/null && [ -z $TMUX ] && [[ ! $TERM =~ screen ]] && tmux attach-session
;o)
So, why is new-session -d not doing the trick?
Let plugin script "restore.sh" restore tmux session
Note that if someone is running tmux plugins in the background via run -b (eg run -b '~/.tmux/plugins/tpm/tpm') you may end up killing the temporary session immediately after start, before anything is restored.
It's doing the trick, it start the daemon with creation of a NEW session. At each restart of daemon a new session is created, saved and restored. x retstarts -> x new sessions. Not so fun ;o) A new named session allows it to be deleted immediately after starting the daemon, so that user have just the exact same sessions he left
you may end up killing the temporary session immediately after start, before anything is restored.
If you kill the last tmux session, you kill the daemon (on manjaro / ubuntu)
Sorry, there is an error in my proposal
I'm working on strongly solution in regards to my comment https://github.com/tmux-plugins/tmux-continuum/pull/7#issuecomment-732182110 and my difficulties to kill-session inside the starting script ...
So, why is
new-session -dnot doing the trick?Let plugin script "restore.sh" restore tmux session
Note that if someone is running tmux plugins in the background via
run -b(egrun -b '~/.tmux/plugins/tpm/tpm') you may end up killing the temporary session immediately after start, before anything is restored.
You are right about the '-b' option, I made a mistake by forgetting it; o)