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
Originally posted by networkhermit January 17, 2025
There are occasions when users want to inject environment variables to the terminal emulator, like the env config provided by alacritty.
Currently there are two ways in ghostty to achieve similar outcome:
Tweak the command configuration like command = /usr/bin/env WINIT_X11_SCALE_FACTOR="1.0" "${SHELL}" -l. Personally I think it is verbose and platform dependent.
Add environment variables in .zshrc/.bashrc/config.fish guarded by if [[ "$TERM_PROGRAM" = ghostty ]]; blocks. It works but I hope to use a more non-intrusive method.
Introduce an env configuration (similar in its naming simplicity to command). The configuration value is syntax KEY=VALUE and only one may be specified per key, but the key may be repeated. Example:
env = foo=barenv = bar=baz
Just like any other repeatable string type configuration we support, setting it to empty will reset the value to the default (which in our case is... empty).
The text was updated successfully, but these errors were encountered:
jcollie
added a commit
to jcollie/ghostty
that referenced
this issue
Jan 22, 2025
Fixesghostty-org#5257
Specify environment variables to pass to commands launched in a terminal
surface. The format is `env=KEY=VALUE`.
`env = foo=bar`
`env = bar=baz`
Setting `env` to an empty string will reset the entire map to default
(empty).
`env =`
Setting a key to an empty string will remove that particular key and
corresponding value from the map.
`env = foo=bar`
`env = foo=`
will result in `foo` not being passed to the launched commands.
Setting a key multiple times will overwrite previous entries.
`env = foo=bar`
`env = foo=baz`
will result in `foo=baz` being passed to the launched commands.
These environment variables _will not_ be passed to commands run by Ghostty
for other purposes, like `open` or `xdg-open` used to open URLs in your
browser.
Discussed in #5197
Originally posted by networkhermit January 17, 2025
There are occasions when users want to inject environment variables to the terminal emulator, like the env config provided by alacritty.
Currently there are two ways in ghostty to achieve similar outcome:
command
configuration likecommand = /usr/bin/env WINIT_X11_SCALE_FACTOR="1.0" "${SHELL}" -l
. Personally I think it is verbose and platform dependent.if [[ "$TERM_PROGRAM" = ghostty ]];
blocks. It works but I hope to use a more non-intrusive method.Past closed disscussion in #3776.
Proposal
Introduce an
env
configuration (similar in its naming simplicity tocommand
). The configuration value is syntaxKEY=VALUE
and only one may be specified per key, but the key may be repeated. Example:Just like any other repeatable string type configuration we support, setting it to empty will reset the value to the default (which in our case is... empty).
The text was updated successfully, but these errors were encountered: