mintty / wsltty

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

Can't save options when running mintty with --exec #351

Closed idbrii closed 1 month ago

idbrii commented 4 months ago

When I click Save, I get a failure to save error with a surprising path.

Seems related to #183, but why is it using a path inside the installation directory?

I run a my gui program in mintty to see its stdout. My program seems to be unrelated and any .bat triggers this problem.

C:\scratch\mintty_test.bat contains:

echo test
pause
  1. Win + R
  2. Type %USERPROFILE%\scoop\apps\wsltty\current\bin\mintty.exe --exec C:\scratch\mintty_test.bat and hit enter
  3. Right click top left icon > Options > Text > change font. Save.
  4. Get error:
---------------------------
Error
---------------------------
Could not save options to 'C:\Users\idbrii\scoop\apps\wsltty\3.7.4\home\idbrii\.minttyrc':
No such file or directory.
---------------------------
OK   
---------------------------

The readme says "a wsltty configuration directory in the user’s application folder %APPDATA%", so it seems wrong that the path is in the installation directory instead of somewhere in %APPDATA%.

I also tried setting the config directory, but it fails with the exact same message:

%USERPROFILE%\scoop\apps\wsltty\current\bin\mintty.exe --configdir="%APPDATA%\wsltty" --exec C:\scratch\mintty_test.bat

I've installed wsltty 3.7.4 with scoop.

If I use launch "WSL Terminal" or "Ubuntu Terminal" out of Start Menu, then I can change font on them and save without issues.

I just started using mintty again, but used it years ago and I have a .minttyrc in my %userprofile%, but removing it doesn't fix the error.

Workaround

Create the directory and it no longer fails to save. After saving, I see the minttyrc file appear.

mintty commented 4 months ago

You've decoupled mintty as embedded in a wsltty installation from its purpose as a WSL terminal. In this case, behaviour is actually correct; configuration is expected in the user's home directory which is inside this installation (but is does not exist). If you run mintty in WSL support mode (options --WSL or --wsl), these configuration locations are skipped.

Maybe it would be a good feature if you can reuse mintty from wsltty as a standalone terminal...

idbrii commented 4 months ago

If I understand you correctly, mintty would behave as I expect if I installed it separately from wsltty because that build is slightly different?

mintty commented 3 months ago

No, but with the tweak I uploaded the next release will skip $HOME if it does not exist.

idbrii commented 3 months ago

Ah, I see. In the mode I'm running, mintty sets $HOME to the install directory.

Looks like I might need to write settings into $APPDATA/mintty/config, but I'll see when there's a new build. Thanks!

mintty commented 3 months ago

Ah, I see. In the mode I'm running, mintty sets $HOME to the install directory.

Rather to /home/$USERNAME, I hope, which is below the install directory, which itself is mapped to /. You can test that by running mintty /bin/dash then cd $HOME or running mintty cmd then cd %HOME% which should fail.

mintty commented 1 month ago

Released 3.7.6.