Closed ehandal closed 3 years ago
WSL (and Linux kernel) does not know what mintty/wsltty is. That TERM
value would be meaningless.
Is this something I should take up in the mintty/mintty repo?
This is WSL-specific so it's sufficient to discuss it here. And yes, it can be done.
By the way, you can also type a terminal name of your choice into the Term field instead of using the popup selection.
@Biswa96, mintty and mintty-direct are included in the terminfo database. That way, Ubuntu WSL knows them, other WSL distributions don't. Detecting whether xterm-direct, mintty, mintty-direct terminfo entries are installed is now related to WSL if active.
O, terminfo(5) works, C makes sense. I don't know about other GNU/Linux distributions but ArchLinux has /usr/share/terminfo/m/mintty* from ncurses package.
By the way, you can also type a terminal name of your choice into the Term field instead of using the popup selection.
I did try changing the Term field in the GUI and setting it directly in AppData\Roaming\wsltty\config, but neither had an effect on the $TERM variable. Messing around now, it actually seems like I can't get $TERM to be anything other than "xterm-256color", no matter what I set Term to in mintty. Not sure if this is some kind of user error or weirdness in my setup.
Hmm, that seems to be a default setting of the WSL system if TERM is not previously set.
So wsltty should use option -e TERM
with wslbridge2 to propagate its value to WSL.
Or maybe wslbridge2 should always do that by default?
Added this in mintty.
Released 3.5.0.
Or maybe wslbridge2 should always do that by default?
Will this do the trick?
diff --git a/src/wslbridge2.cpp b/src/wslbridge2.cpp
index 300ad57..6ee51a1 100644
--- a/src/wslbridge2.cpp
+++ b/src/wslbridge2.cpp
@@ -182,6 +182,9 @@ int main(int argc, char *argv[])
};
class Environment env;
+ env.set("APPDATA");
+ env.set("TERM");
+
class TerminalState termState;
std::string distroName, customBackendPath;
std::string winDir, wslDir, userName;
If "env.set" means to propagate the respective value magically, yes. For wsltty, however, it is irrelevant as I've meanwhile built this into mintty via "-e" options.
I'd like wsltty to use TERM=mintty-direct. mintty sees if some terminal types exist in /usr/share/terminfo and ~/.terminfo before allowing them to be set. See: https://github.com/mintty/mintty/blob/8019cb23e2e453a7f2f5dc6c0978310100d97496/src/config.c#L2248
These terminfo entries are definitely installed, so it's probably just that mintty is unable to look at the right folders inside WSL. It's possible this would need support from mintty itself (and I could submit an issue in mintty instead), but is there a way for wsltty to point mintty at the correct paths or at least allow users to force the setting of terminal type for xterm-direct, mintty, and mintty-direct.