Per-window environment variables
trombonehero opened this issue · 3 comments
It would be nice if I could set different environment values in different windows within a session.
Using tmuxp 1.15.0, libtmux 0.15.4, I can set environment variables for a session, e.g.:
session_name: foo
environment:
DATABASE_URL: "..."However, what I really want to do is set different env vars in different windows, e.g.:
session_name: foo
environment:
DATABASE_URL: "sqlite3:///default.db"
windows:
- window_name: deprecated
environment:
DATABASE_URL: "... one test DB ..."
- window_name: not_ready_yet
environment:
DATABASE_URL: "... another test DB ..."Thanks!
@tony I could work on this issue if accepted. I could also generalize it to allow setting up pane-specific environments as well (if you agree on that).
@zappolowski Go for it
Just one question on the desired/expected behavior. Given this (currently hypothetical) configuration:
session_name: env-test
environment:
ENV_VAR: "session"
windows:
- panes:
- "echo $ENV_VAR == window"
- environment:
ENV_VAR: "pane"
shell_command: "echo $ENV_VAR == pane"
- "echo $ENV_VAR == ???"
environment:
ENV_VAR: "window"
- panes:
- "echo $ENV_VAR == session"What should be the value of ???? Should it be window, i.e. pane environment falls back to window environment before using session environment, or should it be session, which means that it always ignores the window environment in that case?