Skip to content

This issue was moved to a discussion.

You can continue the conversation there. Go to discussion →

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

WT_WINDOWID available as env variable #17863

Closed
cavanaug opened this issue Sep 4, 2024 · 4 comments
Closed

WT_WINDOWID available as env variable #17863

cavanaug opened this issue Sep 4, 2024 · 4 comments
Labels
Issue-Feature Complex enough to require an in depth planning process and actual budgeted, scheduled work. Needs-Attention The core contributors need to come back around and look at this ASAP. 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

Comments

@cavanaug
Copy link

cavanaug commented Sep 4, 2024

Description of the new feature/enhancement

Add WT_WINDOWID to the client environment that has the window id for that Windows Terminal Instance.

I would like to make some calls to wt.exe to automate things, but it is a giant pain in the backside to try to figure out the WindowId. Perhaps Im missing something but we already have WT_PROFILE_ID & WT_SESSION available in the environment. Why not the WindowId which would be really useful for any automation calls to wt.exe?

Or perhaps there is an easier way to do this that I am missing??

Proposed technical implementation details (optional)

Pass a new WT_WINDOWID to the WSL environment to allow for automation scripts to call wt.exe specifying the window.

@cavanaug cavanaug added the Issue-Feature Complex enough to require an in depth planning process and actual budgeted, scheduled work. label Sep 4, 2024
@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 Sep 4, 2024
@DHowett
Copy link
Member

DHowett commented Sep 5, 2024

There's a few blockers here. The main one is that we can't update the process's environment after it's been spawned (especially not in the case of WSL), so when you move a tab between windows such an identifier would immediately fall out of sync. That's solvable (for example, maybe we should let you say "I want the window hosting session aaaaaaaa-bbbb..."?)

Others include...

  • We need to complete work on the console client side to let us inject things (including WT_SESSION!) into newly-launched processes, so that apps launched into Terminal via the "Default Terminal" setting get the same tracking info (Terminal env vars (WT_SESSION, etc) aren't set when set as the Default Terminal #13006)
  • Those environment variables would be inherited, so launching e.g. VS Code from Terminal may result in subprocesses in VSC targeting Terminal windows that they share no ancestry with.

In general, we've been "offering" -w 0 as shorthand for the most recently used window. It's not ideal if you have things running happily along in the background, though, I will admit.

@cavanaug
Copy link
Author

cavanaug commented Sep 5, 2024

Ah, I didnt consider some of those use cases. Would it be possible to have a command line option for wt.exe (or perhaps something similar) that given a WT_SESSION it would return the WT_WINDOWID? That way you could more easily map to WindowId?

I guess to truly do this in a dynamic fashion inside of WSL you would need some type of synthetic device and driver. That Im sure is a non-trivial effort.

@zadjii-msft
Copy link
Member

FWIW I do have plans to have -w 0 do The Smart Thing, and figure out the right window ID based on the current WT_SESSION_ID. That's tracked over in #10561. Would that work for your use case/?

Otherwise, there's probably something we could do with having wt.exe write out windows,tabs,panes,session_ids straight to stdout, now that we're post-#7337

@microsoft-github-policy-service microsoft-github-policy-service bot added the Needs-Author-Feedback The original author of the issue/PR needs to come back and respond to something label Sep 5, 2024
@cavanaug
Copy link
Author

cavanaug commented Sep 5, 2024 via email

@microsoft-github-policy-service microsoft-github-policy-service bot added Needs-Attention The core contributors need to come back around and look at this ASAP. and removed Needs-Author-Feedback The original author of the issue/PR needs to come back and respond to something labels Sep 5, 2024
@microsoft microsoft locked and limited conversation to collaborators Sep 25, 2024
@carlos-zamora carlos-zamora converted this issue into discussion #17963 Sep 25, 2024

This issue was moved to a discussion.

You can continue the conversation there. Go to discussion →

Labels
Issue-Feature Complex enough to require an in depth planning process and actual budgeted, scheduled work. Needs-Attention The core contributors need to come back around and look at this ASAP. 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
Projects
None yet
Development

No branches or pull requests

3 participants