slave: set $TERM_PROGRAM and $TERM_PROGRAM_VERSION environment variables

These are already being set by iTerm2, WezTerm, tmux and likely some
others. Even though using yet more environment variables seems rather
questionable, if we don't set these we run the risk of inheriting them
from other terminals.

See also:

* 97a6078df8/sources/PTYSession.m (L2568-2570)
* 1d0f68dee9/environ.c (L263-L264)
* https://github.com/search?q=TERM_PROGRAM&type=code
This commit is contained in:
Craig Barnes 2023-03-20 14:40:36 +00:00
parent 9f3ce9236f
commit 5b2f02d826
5 changed files with 28 additions and 0 deletions

View file

@ -21,6 +21,7 @@
#include "macros.h"
#include "terminal.h"
#include "tokenize.h"
#include "version.h"
#include "xmalloc.h"
extern char **environ;
@ -351,6 +352,8 @@ slave_spawn(int ptmx, int argc, const char *cwd, char *const *argv,
}
setenv("TERM", term_env, 1);
setenv("TERM_PROGRAM", "foot", 1);
setenv("TERM_PROGRAM_VERSION", FOOT_VERSION_SHORT, 1);
setenv("COLORTERM", "truecolor", 1);
setenv("PWD", cwd, 1);