Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Set environment variable WT_FOLDER_PATH to the folder path that contains WindowsTerminal.exe #16295

Closed
daxgames opened this issue Nov 12, 2023 · 7 comments · Fixed by #16949
Closed
Assignees
Labels
Area-Settings Issues related to settings and customizability, for console or terminal Help Wanted We encourage anyone to jump in on these. In-PR This issue has a related PR Issue-Task It's a feature request, but it doesn't really need a major design. Needs-Tag-Fix Doesn't match tag requirements Product-Terminal The new Windows Terminal.

Comments

@daxgames
Copy link

Description of the new feature/enhancement

Set an environment variable WT_FOLDER_PATH to the folder path that contains WindowsTerminal.exe. This variable should be set when Windows Terminal launches before the profile is launched.

This would be useful for users that run Windows Terminal in portable mode so Windows terminal profiles can be configured with paths relative to the folder wher WIndows Terminal is installed as shown below:

image

The normal user profile is configured as shown below and works perfectly because the %CMDER_ROOT% env variable was set dynamically before launching Windows Terminal.

image

The above configuration does not work when launching as Administrator because the %CMDER_ROOT% env variable is not set globally on the system nor in the Administator's personal environment variables. it produces the error below:

image

For completeness sake the icon config being complained about in the error above is below:

image

Proposed technical implementation details (optional)

@daxgames daxgames added the Issue-Feature Complex enough to require an in depth planning process and actual budgeted, scheduled work. label Nov 12, 2023
@microsoft-github-policy-service microsoft-github-policy-service bot added Needs-Tag-Fix Doesn't match tag requirements Needs-Triage It's a new issue that the core contributor team needs to triage at the next triage meeting labels Nov 12, 2023
@zadjii-msft
Copy link
Member

This really falls under the same problem space as #13006 et al. We could add that, sure,

Wait, no it doesn't. This is actually so simple. Set that variable for terminal itself. So that we can resolve things relative to ourself. brilliant.

I think we were already tracking this in #15379 but I'll motion to use this as the tracking thread instead, since this has a real good idea. Thanks!

@zadjii-msft zadjii-msft added Product-Terminal The new Windows Terminal. Issue-Task It's a feature request, but it doesn't really need a major design. and removed Issue-Feature Complex enough to require an in depth planning process and actual budgeted, scheduled work. labels Nov 13, 2023
@zadjii-msft zadjii-msft added this to the Terminal v1.20 milestone Nov 13, 2023
@carlos-zamora carlos-zamora added Help Wanted We encourage anyone to jump in on these. Area-Settings Issues related to settings and customizability, for console or terminal and removed Needs-Triage It's a new issue that the core contributor team needs to triage at the next triage meeting Needs-Tag-Fix Doesn't match tag requirements labels Nov 15, 2023
@zadjii-msft zadjii-msft self-assigned this Mar 27, 2024
@microsoft-github-policy-service microsoft-github-policy-service bot added the In-PR This issue has a related PR label Mar 27, 2024
github-merge-queue bot pushed a commit that referenced this issue Mar 28, 2024
…6949)

Basically, title. 

It'd be a neat idea for portable installs of the Terminal to reference
files that are right there in the portable install.

This PR adds a `WT_SETTINGS_DIR` var to Terminal's own env block. This
allows us to resolve profiles relative to our own settings folder.

Closes #16295
@microsoft-github-policy-service microsoft-github-policy-service bot added the Needs-Tag-Fix Doesn't match tag requirements label Mar 28, 2024
DHowett pushed a commit that referenced this issue Apr 22, 2024
…6949)

Basically, title.

It'd be a neat idea for portable installs of the Terminal to reference
files that are right there in the portable install.

This PR adds a `WT_SETTINGS_DIR` var to Terminal's own env block. This
allows us to resolve profiles relative to our own settings folder.

Closes #16295

(cherry picked from commit 36c81f2)
Service-Card-Id: 92352620
Service-Version: 1.20
@daxgames
Copy link
Author

daxgames commented May 28, 2024

The implemented solution in #16949:

  1. Is confusing.
  • Is it %WT_SETTINGS_DIR% or %WT_SETTINGS_PATH%
  • I THINK it is %WT_SETTINGS_DIR% because it seems to MOSTLY work.
  • Does not COMPLETELY solve this issue. See below.

New Config:

image

Launching the profile:

image

The paths exist because the shell is configured using "%WT_SETTINGS_DIR%\..\..\init.bat" and the tab icon is correctly read from "%WT_SETTINGS_DIR%......\icons\cmder_red.ico".

@daxgames
Copy link
Author

daxgames commented May 28, 2024

Also why can't this just be a normal env variable like the below that are set in 1.20.x:

image

Like this:

image

@DHowett
Copy link
Member

DHowett commented May 28, 2024

Image

It's WT_SETTINGS_DIR 😄
(It may not work in the commandline field - we need to investigate that. It should work in any other field in the settings that supports paths.)

@daxgames
Copy link
Author

See my edited comment above.

@DHowett
Copy link
Member

DHowett commented May 28, 2024

Thanks!

@daxgames
Copy link
Author

Thanks for the quick response and the fix!

I looked at the PR and it went back and forth on %WT_SETTINGS_DIR% and %WT_SETTINGS_PATH%. After posting the issue I went to the Release Notes and saw the correct env var but it still throws the icon message. Other than that it all works!

My only other concern is wrapping the icon path with double quotes causes it to fail. Not sure if that would be an issue if the icon were in a path that contained spaces.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Area-Settings Issues related to settings and customizability, for console or terminal Help Wanted We encourage anyone to jump in on these. In-PR This issue has a related PR Issue-Task It's a feature request, but it doesn't really need a major design. Needs-Tag-Fix Doesn't match tag requirements Product-Terminal The new Windows Terminal.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants