gpakosz/.tmux

Create predefined sessions on `tmux` start

ww7 opened this issue · 6 comments

ww7 commented

I want to have some predefined named sessions at tmux start, added to .tmux.local

new-session -d -s dummy # to start session index from 1
new-session -d -s w # locals
new-session -d -s s # remotes

(also tried to add -A)

But after config reload via prefix+r shows error:

'"$TMUX_PROGRAM" source "$TMUX_CONF_LOCAL"' returned 1

At the same time, config reloads.
Would it be possible to omit or suppress this error?

ww7 commented

Command

run '"$TMUX_PROGRAM" has-session -t dummy 2>/dev/null || tmux new-session -A -s dummy -d; tmux attach-session -t dummy'

Also shows same error.

Hello @ww7 👋

I did try to add the same command you're mentioning to my .local customization files and there's no error.
You likely added something else.

Please make sure your didn't alter the .conf file and maybe try again with a stock .local file.

ww7 commented

Hello @gpakosz

On my side the same error with fresh Oh my tmux!

Seems config reload trying to create a session when it already exists.

Seems config reload trying to create a session when it already exists.

Does it happen without using Oh my tmux!?

What OS are you using btw?

ww7 commented

@gpakosz

What OS are you using btw?

macOS Sonoma and Linux Ubuntu 20.04, on both reload of config shows error, on latestOh my tmux!

Does it happen without using Oh my tmux!?

On such empty .tmux.conf

new -A -d -s dummy 
bind r run '/usr/bin/tmux source /root/.tmux.conf'
set-option -g detach-on-destroy off

resulting '/usr/bin/tmux source /root/.tmux.conf' returned 1

ww7 commented

As the previous Tmux configuration-based approach makes error, I solved this with Bash functions.