Skip to content
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

Per-window environment variables #832

Closed
trombonehero opened this issue Oct 5, 2022 · 3 comments · Fixed by #845
Closed

Per-window environment variables #832

trombonehero opened this issue Oct 5, 2022 · 3 comments · Fixed by #845

Comments

@trombonehero
Copy link

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!

@zappolowski
Copy link
Contributor

@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).

@tony
Copy link
Member

tony commented Nov 1, 2022

@zappolowski Go for it

@zappolowski
Copy link
Contributor

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?

zappolowski added a commit to zappolowski/tmuxp that referenced this issue Nov 7, 2022
zappolowski added a commit to zappolowski/tmuxp that referenced this issue Nov 7, 2022
tony pushed a commit to zappolowski/tmuxp that referenced this issue Nov 13, 2022
tony pushed a commit to zappolowski/tmuxp that referenced this issue Nov 13, 2022
zappolowski added a commit to zappolowski/tmuxp that referenced this issue Nov 13, 2022
zappolowski added a commit to zappolowski/tmuxp that referenced this issue Nov 13, 2022
zappolowski added a commit to zappolowski/tmuxp that referenced this issue Nov 21, 2022
zappolowski added a commit to zappolowski/tmuxp that referenced this issue Nov 24, 2022
zappolowski added a commit to zappolowski/tmuxp that referenced this issue Nov 26, 2022
@tony tony closed this as completed in #845 Nov 26, 2022
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 a pull request may close this issue.

3 participants