You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
It seems that there is a split between folks who find the current environment behavior (global environment set at server start time) intuitive and those who find it confusing. I think this thread is a good indication of that. I find myself in the second category, where my intuitive understanding is that each new session is a child of the shell in which you started it, and thus should inherit those environment variables; this works on the first session you create, but not the second if it has a different set of variables. I understand why, but to me the server that starts with the first session is an implementation detail, not part of my mental model of how tmux works.
In my work environment, I work on multiple projects and tasks, and each session is dedicated to a task. We have a custom system of environment variables to set the project data, and then I often will have a python virtual environment set on top of it. At any rate, my workaround is to create an alias tmux-session to tmux new-session -e "SC=$SC" -e "VIRTUAL_ENV=$VIRTUAL_ENV", though that will miss a few edge cases.
Looking through everything, one obvious solution is to do new tasks in a new server. However, its harder to do things like list and reattach to those, especially since I'm pulled in many directions I can forget the server names I picked pretty easily, and it doesn't seem like how tmux is intended to be used. update-environment doesn't do what I want, because it will update things when you reattach, which isn't what I want or expect for this, though it's obviously useful for other purposes.
I had three thoughts on potential better choices, none of which are mutually exclusive:
Have better tools to list, reattach, and close single sessions on servers created in the default area (i.e. with -L)
Have a setting like update-newsession-environment that you can add to tmux.conf that lists variables you want to update only on a new session, not reattaching one like update-environment.
Have a setting that updates the default behavior to take the session environment from the parent shell when running new-session. Either a separate setting or just the previous suggestion in the form set-option -g update-newsession-environment *.
Maybe there are subtleties I don't see, but I couldn't find any other proposals or rejections of these kinds of changes. There seems to be enough confusion and desire that its worth having something in addition to -e.
reacted with thumbs up emoji reacted with thumbs down emoji reacted with laugh emoji reacted with hooray emoji reacted with confused emoji reacted with heart emoji reacted with rocket emoji reacted with eyes emoji
-
It seems that there is a split between folks who find the current environment behavior (global environment set at server start time) intuitive and those who find it confusing. I think this thread is a good indication of that. I find myself in the second category, where my intuitive understanding is that each new session is a child of the shell in which you started it, and thus should inherit those environment variables; this works on the first session you create, but not the second if it has a different set of variables. I understand why, but to me the server that starts with the first session is an implementation detail, not part of my mental model of how tmux works.
In my work environment, I work on multiple projects and tasks, and each session is dedicated to a task. We have a custom system of environment variables to set the project data, and then I often will have a python virtual environment set on top of it. At any rate, my workaround is to create an alias
tmux-session
totmux new-session -e "SC=$SC" -e "VIRTUAL_ENV=$VIRTUAL_ENV"
, though that will miss a few edge cases.Looking through everything, one obvious solution is to do new tasks in a new server. However, its harder to do things like list and reattach to those, especially since I'm pulled in many directions I can forget the server names I picked pretty easily, and it doesn't seem like how tmux is intended to be used.
update-environment
doesn't do what I want, because it will update things when you reattach, which isn't what I want or expect for this, though it's obviously useful for other purposes.I had three thoughts on potential better choices, none of which are mutually exclusive:
update-newsession-environment
that you can add to tmux.conf that lists variables you want to update only on a new session, not reattaching one likeupdate-environment
.set-option -g update-newsession-environment *
.Maybe there are subtleties I don't see, but I couldn't find any other proposals or rejections of these kinds of changes. There seems to be enough confusion and desire that its worth having something in addition to
-e
.Beta Was this translation helpful? Give feedback.
All reactions