Scrub multiplexer variables from the child environment

A new st window is never inside tmux/screen/zellij, even when st was
launched from one. Programs like kitten icat check TMUX to decide
whether to wrap escape codes in a DCS passthrough, which then fails
because st is not tmux.
This commit is contained in:
a 2026-09-07 03:11:27 -05:00
parent 90f40ce703
commit 6499e88485
No known key found for this signature in database
GPG Key ID: 2F22877AA4DFDADB

10
st.c
View File

@ -909,6 +909,16 @@ execsh(char *cmd, char **args)
unsetenv("COLUMNS"); unsetenv("COLUMNS");
unsetenv("LINES"); unsetenv("LINES");
unsetenv("TERMCAP"); unsetenv("TERMCAP");
/*
* A new st window is never inside a multiplexer, even when st itself
* was launched from one. Programs such as kitten icat use these to
* decide whether to wrap escape codes for tmux, which breaks them.
*/
unsetenv("TMUX");
unsetenv("TMUX_PANE");
unsetenv("STY");
unsetenv("ZELLIJ");
unsetenv("ZELLIJ_SESSION_NAME");
setenv("LOGNAME", pw->pw_name, 1); setenv("LOGNAME", pw->pw_name, 1);
setenv("USER", pw->pw_name, 1); setenv("USER", pw->pw_name, 1);
setenv("SHELL", sh, 1); setenv("SHELL", sh, 1);