diff options
author | Christian Persch <chpe@src.gnome.org> | 2022-11-16 20:09:45 +0100 |
---|---|---|
committer | Christian Persch <chpe@src.gnome.org> | 2022-11-16 20:09:45 +0100 |
commit | 1fff2a9b6b5356e936a7e048d5de9714f0831046 (patch) | |
tree | 45577a9abfa7d2c0aa632ae802f7b392bbe34aee /src | |
parent | f742415812d0f244bbacdfb67b26f8583a8b6d8c (diff) | |
download | gnome-terminal-1fff2a9b6b5356e936a7e048d5de9714f0831046.tar.gz |
client: Improve env var filters
Add some more env vars, and add an exception to the prefix filtering
(taken from latest xterm).
Diffstat (limited to 'src')
-rw-r--r-- | src/terminal-client-utils.cc | 34 |
1 files changed, 34 insertions, 0 deletions
diff --git a/src/terminal-client-utils.cc b/src/terminal-client-utils.cc index 8514b4ee..d7c59fe4 100644 --- a/src/terminal-client-utils.cc +++ b/src/terminal-client-utils.cc @@ -207,8 +207,10 @@ char const* const* terminal_client_get_environment_filters (void) { static char const* filters[] = { + "COLORFGBG", "COLORTERM", "COLUMNS", + "DEFAULT_COLORS", "DESKTOP_STARTUP_ID", "EXIT_CODE", "EXIT_STATUS", @@ -233,10 +235,15 @@ terminal_client_get_environment_filters (void) "REMOTE_PORT", "SERVICE_RESULT", "SHLVL", + "STY", "TERM", + "TERMCAP", + "TMUX", + "TMUX_PANE", "VTE_VERSION", "WATCHDOG_PID", "WATCHDOG_USEC", + "WCWIDTH_CJK_LEGACY", "WINDOWID", "XDG_ACTIVATION_TOKEN", nullptr @@ -250,6 +257,7 @@ terminal_client_get_environment_prefix_filters (void) { static char const* filters[] = { "GNOME_TERMINAL_", + // "VTE_", ? /* other terminals */ "FOOT_", @@ -268,6 +276,18 @@ terminal_client_get_environment_prefix_filters (void) return filters; } +static char const* const* +terminal_client_get_environment_prefix_filters_excludes(void) +{ + static char const* filters[] = { + "MC_XDG_OPEN", + + nullptr, + }; + + return filters; +} + static char** terminal_environ_unsetenv_prefix (char** envv, char const* prefix) @@ -282,6 +302,20 @@ terminal_environ_unsetenv_prefix (char** envv, auto const equal = strchr(envv[i], '='); g_assert(equal != nullptr); gs_free char* env = g_strndup(envv[i], equal - envv[i]); + + auto excluded = false; + auto const excludes = terminal_client_get_environment_prefix_filters_excludes(); + for (auto j = 0; excludes[j]; ++j) { + if (!g_str_equal(excludes[j], env)) + continue; + + excluded = true; + break; + } + + if (excluded) + continue; + envv = g_environ_unsetenv (envv, env); } |