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

Expose the profile GUID to the environment (WT_PROFILE, WT_PROFILE_GUID?) #3589

Closed
JustinGrote opened this issue Nov 15, 2019 · 12 comments · Fixed by #4852
Closed

Expose the profile GUID to the environment (WT_PROFILE, WT_PROFILE_GUID?) #3589

JustinGrote opened this issue Nov 15, 2019 · 12 comments · Fixed by #4852
Assignees
Labels
Area-TerminalConnection Issues pertaining to the terminal<->backend connection interface Issue-Task It's a feature request, but it doesn't really need a major design. Product-Terminal The new Windows Terminal. Resolution-Fix-Committed Fix is checked in, but it might be 3-4 weeks until a release.

Comments

@JustinGrote
Copy link

Description of the new feature/enhancement

We need a way to detect within a running terminal what profile instantiated it, so that we can make on-the-fly changes to the config (like change the background or font). The MSTerminalSetting is an example of that method.

Proposed technical implementation details (optional)

Provide the steps/api to PInvoke to get the profile guid based on the session guid. OR expose the session's profile guid to an environment variable like WT_PROFILE

@JustinGrote JustinGrote added the Issue-Feature Complex enough to require an in depth planning process and actual budgeted, scheduled work. label Nov 15, 2019
@ghost ghost added 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, 2019
@DHowett-MSFT DHowett-MSFT changed the title Resolve the Profile name from the WT_SESSION ID, or publish the profile GUID as WT_SESSIONGUID Expose the profile GUID to the environment (WT_PROFILE, WT_PROGILE_GUID?) Nov 18, 2019
@DHowett-MSFT DHowett-MSFT added Area-TerminalConnection Issues pertaining to the terminal<->backend connection interface Issue-Task It's a feature request, but it doesn't really need a major design. Product-Terminal The new Windows Terminal. and removed Issue-Feature Complex enough to require an in depth planning process and actual budgeted, scheduled work. Needs-Triage It's a new issue that the core contributor team needs to triage at the next triage meeting labels Nov 18, 2019
@ghost ghost removed the Needs-Tag-Fix Doesn't match tag requirements label Nov 18, 2019
@DHowett-MSFT DHowett-MSFT added this to the Terminal Backlog milestone Nov 18, 2019
@DHowett-MSFT DHowett-MSFT changed the title Expose the profile GUID to the environment (WT_PROFILE, WT_PROGILE_GUID?) Expose the profile GUID to the environment (WT_PROFILE, WT_PROFILE_GUID?) Nov 18, 2019
@DHowett-MSFT DHowett-MSFT self-assigned this Nov 18, 2019
@Jaykul
Copy link
Contributor

Jaykul commented Feb 15, 2020

I'd settle for setting WT_SESSION to the profile GUID instead of the seemingly pointless session GUID...

@oising
Copy link
Collaborator

oising commented Mar 10, 2020

I'd settle for setting WT_SESSION to the profile GUID instead of the seemingly pointless session GUID...

It's possible to have the profile open in multiple places though, with different "sessions" -- I think this guid is keyed to the conpty connection itself, so it kinda needs to be unique globally.

@JustinGrote
Copy link
Author

JustinGrote commented Mar 10, 2020

@oising The main goal would be for a program running inside of windows terminal to be able to "find" what profile it is currently using, so that it can customize the settings.json for that profile in real-time.

As far as I understand there is no API to determine that using the WT_SESSION variable, unless you can enlighten me.

Invoke-TerminalGif as an example (currently I have to do a nasty workaround to make it work):
image

It doesn't have to replace WT_SESSION, it could instead be WT_PROFILE_GUID as mentioned.

@Jaykul
Copy link
Contributor

Jaykul commented Mar 10, 2020

I'd settle for setting WT_SESSION to the profile GUID instead of the seemingly pointless session GUID...

It's possible to have the profile open in multiple places though, with different "sessions" -- I think this guid is keyed to the conpty connection itself, so it kinda needs to be unique globally.

It "needs" to be unique for what? What can we use a session guid for?

@DHowett-MSFT
Copy link
Contributor

unique

WT_SESSION is an integral part of #766 and #961 that allows shells to cache and recover state as part of overall session restoration. It's analogous to TERMINAL_SESSION_ID on OS X.

@JustinGrote
Copy link
Author

@oising As the OP of this issue, the proposal you have here #4852 (comment) would satisfy my requirement and this can be closed once merged

@oising oising assigned oising and unassigned DHowett-MSFT Mar 10, 2020
@oising
Copy link
Collaborator

oising commented Mar 10, 2020

@JustinGrote It's in the PR now as WT_PROFILE_ID and is in review. Will close when merged.

@Jaykul
Copy link
Contributor

Jaykul commented Apr 12, 2020

But we won't get it until some time after 1.0 - so the idea of using it in a script is basically DOA for months.

@oising
Copy link
Collaborator

oising commented Apr 12, 2020

But we won't get it until some time after 1.0 - so the idea of using it in a script is basically DOA for months.

I tried :/

@ghost ghost added the In-PR This issue has a related PR label Apr 17, 2020
@ghost ghost closed this as completed in #4852 Apr 17, 2020
@ghost ghost removed the In-PR This issue has a related PR label Apr 17, 2020
@ghost ghost added the Resolution-Fix-Committed Fix is checked in, but it might be 3-4 weeks until a release. label Apr 17, 2020
ghost pushed a commit that referenced this issue Apr 17, 2020
This commit adds a `WT_PROFILE_ID` environment variable, which contains
the guid of the active profile.

It also teaches ConptyConnection to take an environment map on creation.

We had to do a little manual jiggery with the WSLENV environment
variable as passed by the creator.

* [x] CLA signed
* [ ] Tests added/passed
* [ ] Requires documentation to be updated
* [x] I've discussed this with core contributors already.

Ran terminal, validated vars and translated paths under windows and WSL. 

References #4566 (this PR originally introduced WT_SETTINGS/DEFAULTS)
Closes #3589
@oising
Copy link
Collaborator

oising commented Apr 17, 2020

It got merged after all - just had to remove the file path env vars for the moment :) /cc @Jaykul

@Jaykul
Copy link
Contributor

Jaykul commented Apr 18, 2020

Thanks @oising!

@ghost
Copy link

ghost commented Apr 22, 2020

🎉This issue was addressed in #4852, which has now been successfully released as Windows Terminal Preview v0.11.1121.0.:tada:

Handy links:

This issue was closed.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Area-TerminalConnection Issues pertaining to the terminal<->backend connection interface Issue-Task It's a feature request, but it doesn't really need a major design. Product-Terminal The new Windows Terminal. Resolution-Fix-Committed Fix is checked in, but it might be 3-4 weeks until a release.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants