mintty / wsltty

Mintty as a terminal for Bash on Ubuntu on Windows / WSL
Other
3.12k stars 104 forks source link

Pass arguments to wslbridge2 from wsltty shortcut? #283

Closed wjrogers closed 3 years ago

wjrogers commented 3 years ago

Is there a way to pass arguments to wslbridge2 from a wsltty shortcut? I would like to make a custom shortcut that sets an environment variable in the WSL2 session. I can't find any way to do this with wsltty, but I see that wslbridge2 has an -e parameter for setting environment variables.

Biswa96 commented 3 years ago

Example: C:\Users\UserName\AppData\Local\wsltty\bin\mintty.exe -e /bin/wslbridge2.exe -e USERPROFILE

mintty commented 3 years ago

Strange enough, this does not seem to work with USERPROFILE for me although it works for other variables. Anyway, to set up a WSL session, remember to preserve other parameters like -c and change --WSL to --wsl to get mintty features adjusted to WSL.

wjrogers commented 3 years ago

Thanks for the pointers. So far, I have:

%LOCALAPPDATA%\wsltty\bin\mintty.exe --WSLmode="Ubuntu" --configdir="%APPDATA%\wsltty" -e /bin/wslbridge2.exe -W~ -e TMUX_DISABLED=1 -l

which launches WSL2, but TMUX_DISABLED is not set. (edit: This works!)

I have my .bashrc scripted to exec tmux, which is what I want 99% of the time, but I thought it would be useful to have a second shortcut that disabled the feature via an environment variable. I suppose I could go the other way and have wslbridge launch tmux instead of my shell? I chose this method because I use the same dotfiles to automatically run a persistent remote tmux session via SSH.

wjrogers commented 3 years ago

The above shortcut command line does work! I had made a typo in my bash script that confused the issue. Thanks again for the help.