Skip to content

Add option to allow kill the default sessions created when tmux server starts #7

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
wants to merge 2 commits into from

Conversation

paulhybryant
Copy link

Add option to allow kill the default sessions created when tmux server starts.

@sappo
Copy link

sappo commented Apr 12, 2016

This is exactly the feature I'm looking for. Please do merge!
Unless there is an easier way to kill that tedious default session.

@sappo
Copy link

sappo commented May 19, 2016

@bruno- this PR solve a valid problem? At least to me and a few of my colleagues. What's the reason for not merging it? If there's a valid reason let's fix it!

@mnarrell
Copy link

Can we have this merged please?

@jasperzs
Copy link

jasperzs commented Mar 3, 2018

@bruno- Can we please merge this PR?

@bruno-
Copy link
Member

bruno- commented Mar 3, 2018

Hi, sorry for the long wait on this one.

Why not make this an option in tmux-resurrect? I can see users using only tmux-resurrect without tmux-continuum wanting the same feature.
And really, only tmux-resurrect should be concerned about the restored content of the tmux env.

@martinisoft
Copy link

I do this as a resurrect hook in my tmux conf set -g @resurrect-hook-post-restore-all 'tmux kill-session -t 0' and it works like a charm, no hacks needed.

@aguytech
Copy link

I do this as a resurrect hook in my tmux conf set -g @resurrect-hook-post-restore-all 'tmux kill-session -t 0' and it works like a charm, no hacks needed.

I'm sorry but when you use the script tmux-resurrect/scripts/restore.sh to restore session, the plugin insert saved sessions with numeric id in the first ids.
So if you kept one session with an id equal to "0", the id of saved session is retored and the new session id is modify to 1.
So if you kill automaticaly the session "0", you kill saved session.

Your solution works if you don't save session with id "0".

@bruno-
Copy link
Member

bruno- commented Nov 28, 2020

This feature is implemented in tmux-resurrect

tmux-plugins/tmux-resurrect@5f5f9d8

@bruno- bruno- closed this Nov 28, 2020
@aguytech
Copy link

Ok I tried 10mn ago with a fresh install of tmux-resurrect & tmux-continuum from github. my tmux version are 3.1_c-1

Everything works like a charm except this :

Just try to repeat 3 times this command :
systemctl restart --user tmux.service

and tell me whats happen with your list of sessions ?
Here is for me :

$ tmux ls
0: 1 windows (created Sun Nov 29 01:04:07 2020)
$ systemctl restart --user tmux.service
$ systemctl restart --user tmux.service
$ systemctl restart --user tmux.service
$ tmux ls
0: 1 windows (created Sun Nov 29 01:14:50 2020)
1: 1 windows (created Sun Nov 29 01:14:50 2020)
2: 1 windows (created Sun Nov 29 01:14:50 2020)
3: 1 windows (created Sun Nov 29 01:14:51 2020)

Something seems to be wrong?

Here is my file .tmux.conf without binds:

# prefix key
set-option -g prefix C-q
# time allowed to repeat key following prefix key
set-option -g repeat-time 500
# set history to 5000
set-option -g history-limit 5000

# tmux-continuum
set -g @continuum-boot 'on'
set -g @continuum-restore 'on'

####  plugins

# resurect plugin
run-shell ~/.tmux/plugins/tmux-resurrect/resurrect.tmux
run-shell ~/.tmux/plugins/tmux-continuum/continuum.tmux

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

7 participants