Systemd: Modifications to remove new session after restoration#83
Systemd: Modifications to remove new session after restoration#83aguytech wants to merge 5 commits intotmux-plugins:masterfrom
Conversation
|
So, why is
Note that if someone is running tmux plugins in the background via |
|
It's doing the trick, it start the daemon with creation of a NEW session. |
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 #7 (comment) and my difficulties to kill-session inside the starting script ... |
| #!/usr/bin/env bash | ||
|
|
||
| CURRENT_DIR="$( dirname ${BASH_SOURCE[0]} )" | ||
| PARENT_DIR="${CURRENT_DIR%/*}" |
| Type=forking | ||
| Environment=DISPLAY=:0 | ||
| ExecStart=/usr/bin/tmux ${systemd_tmux_server_start_cmd} | ||
| ExecStart=${PARENT_DIR}/continuum_start.sh |
There was a problem hiding this comment.
Use a local script to start tmux daemon in place a /usr/bin/tmux
| local tmux_start_script_path="${CURRENT_DIR}/linux_start_tmux.sh" | ||
| local systemd_unit_file=$(template "${tmux_start_script_path}" "${options}") | ||
| mkdir -p "$(dirname ${systemd_unit_file_path})" | ||
| [ ! -d "$(dirname ${systemd_unit_file_path})" ] && mkdir -p "$(dirname ${systemd_unit_file_path})" |
There was a problem hiding this comment.
prevent error when creates existing path (script is executed at each start)
| tmux_server_session_temporary="tmux-continuum-tmp" | ||
| systemd_tmux_server_start_cmd_option="@continuum-systemd-start-cmd" | ||
| systemd_tmux_server_start_cmd_default="new-session -d" | ||
| systemd_tmux_server_start_cmd_default="new-session -d -s ${tmux_server_session_temporary}" |
There was a problem hiding this comment.
starts the daemon with a named session to allow to kill it after starting
aguytech
left a comment
There was a problem hiding this comment.
I need to create a named session to allow his deletion after tmux start, otherwise a new session are created at each start of daemon and are added to restored sessions.
If the daemon start with no saved session, I need to create one before to kill the named one, otherwise I kill the server.
To control this deletion of named session I creates a file to control it: 'continuum_start.sh'
You are right about the '-b' option, I made a mistake by forgetting it; o) |
minor correction on creating new session
The purpose of this modification is to allow session restoration on linux: the way are to :
Let plugin script "restore.sh" restore tmux session
After the start of tmux daemon, start simply tmux with the following command in a terminal console :
tmux a/ attach / attach-sessionor 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)