-
Notifications
You must be signed in to change notification settings - Fork 8.3k
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
Add support for wt.exe to run commands in an existing Terminal Window #4472
Comments
Yes, please. There's a Visual Studio extension, that lets you open command line in the current project folder. I set it to launch wt.exe, and it always creates a new window, but I'd love if I could pass a parameter to wt.exe, so that if Terminal is already running, it would be activated a new tab would open there instead. |
Thanks for the request! I thought we had a backlog item for "allow remote control of a terminal" (like: wt.exe could This is now that issue. Triaged into backlog. /cc @zadjii-msft: I may be wrong in not finding a "remote control" issue |
Partially supported by #2080. |
This was briefly mentioned in this spec
Which yea is part of #2080, but I don't think has it's own issue. |
Wow, I was just thinking about "starting a new program/task in any existing windows terminal window" or a "single instance mode" to populate a WT window with multiple tasks via CLI would be great. But I admit that I'd prefer a "quick and dirty" single instance mode in the near future over a flexible session management in the distant future (as I could use it sooner than later). |
I didn't even know calling Windows binaries works at all! ;-) cmd.exe works, wt.exe doesn't:
|
@mreymann Yeah, this is caused by this AppContainer isolation layer of Appx Packages (Microsoft Store apps) and how their executables are placed in the Would be interesting whether the technology used in WSL1 leads to this actually working, or not... |
This finishes the implementation of `--window` to also accept a string as the "name" of the window. So you can say ```sh wt -w foo new-tab wt -w foo split-pane ``` and have both those commands execute in the same window, the one named "foo". This is just slightly more ergonomic than manually using the IDs of windows. In the future, I'll be working on renaming windows, and displaying these names. > #### `--window,-w <window-id>` > Run these commands in the given Windows Terminal session. This enables opening > new tabs, splits, etc. in already running Windows Terminal windows. > * If `window-id` is `0`, run the given commands in _the current window_. > * If `window-id` is a negative number, or the reserved name `new`, run the > commands in a _new_ Terminal window. > * If `window-id` is the ID or name of an existing window, then run the > commandline in that window. > * If `window-id` is _not_ the ID or name of an existing window, create a new > window. That window will be assigned the ID or name provided in the > commandline. The provided subcommands will be run in that new window. > * If `window-id` is omitted, then obey the value of `windowingBehavior` when > determining which window to run the command in. Before this PR, I think we didn't actually properly support assigning the id with `wt -w 12345`. If `12345` didn't exist, it would make a new window, but just assign it the next id, not assign it 12345. ## References * #4472, #8135 * https://github.com/microsoft/terminal/projects/5 ## Validation Steps Performed Ran tests Messed with naming windows, working as expected. Closes https://github.com/microsoft/terminal/projects/5#card-51431478
this really works it open a new tab, the problem is the directory was reset,.. hoping that I open a new tab, it will be at the same directory in my working project. |
### ⇒ [doc link](https://github.com/microsoft/terminal/blob/dev/migrie/s/653-quake-mode/doc/specs/%23653%20-%20Quake%20Mode/%23653%20-%20Quake%20Mode.md) ⇐ ## Summary of the Pull Request After reading through 114+ comments in #653 and related issues, I think I've finally wrapped my head around all the possible scenarios for quake mode. <!-- Speak now or forever hold your peace. --> This also includes "minimize to tray", because the two are a powerful combination. With the work already prototyped in [`dev/migrie/f/653-QUAKE-MODE`](https://github.com/microsoft/terminal/tree/dev/migrie/f/653-QUAKE-MODE), [I'm starting to believe](https://j.gifs.com/58vKNx.gif) that we could actually land this in 2.0. ### Abstract > Many existing terminals support a feature whereby a user can press a keybinding > anywhere in the OS, and summon their terminal application. Oftentimes the act of > summoning this window is accompanied by a "dropdown" animation, where the window > slides in to view from the top of the screen. This global summon action is often > referred to as "quake mode", a reference to the videogame Quake who's console > slid in from the top. > > This spec addresses both of the following two issues: > * "Quake Mode" ([#653]) > * "Minimize to tray" ([#5727]) ## PR Checklist * [x] Specs: #653, #5727 * [x] References: #5000, #4472, #2227, #7240, #8135 * [x] I work here ## Detailed Description of the Pull Request / Additional comments _\*<sup>\*</sup><sub>\*</sub> read the spec <sub>\*</sub><sup>\*</sup>\*_
### ⇒ [doc link](https://github.com/microsoft/terminal/blob/dev/migrie/s/1032-elevation-qol/doc/specs/%235000%20-%20Process%20Model%202.0/%231032%20-%20Elevation%20Quality%20of%20Life%20Improvements.md) ⇐ ## Summary of the Pull Request Despite my best efforts to mix elevation levels in a single Terminal window, it seems that there's no way to do that safely. With the dream of mixed elevation dead, this spec outlines a number of quality-of-life improvements we can make to the Terminal today. These should make using the terminal in elevated scenarios better, since we can't have M/E. ### Abstract > For a long time, we've been researching adding support to the Windows Terminal > for running both unelevated and elevated (admin) tabs side-by-side, in the same > window. However, after much research, we've determined that there isn't a safe > way to do this without opening the Terminal up as a potential > escalation-of-privilege vector. > > Instead, we'll be adding a number of features to the Terminal to improve the > user experience of working in elevated scenarios. These improvements include: > > * A visible indicator that the Terminal window is elevated ([#1939]) > * Configuring the Terminal to always run elevated ([#632]) > * Configuring a specific profile to always open elevated ([#632]) > * Allowing new tabs, panes to be opened elevated directly from an unelevated > window > * Dynamic profile appearance that changes depending on if the Terminal is > elevated or not. ([#1939], [#8311]) ## PR Checklist * [x] Specs: #1032, #632 * [x] References: #5000, #4472, #2227, #7240, #8135, #8311 * [x] I work here ## Detailed Description of the Pull Request / Additional comments _\*<sup>\*</sup><sub>\*</sub> read the spec <sub>\*</sub><sup>\*</sup>\*_ ### Why are these two separate documents? I felt that the spec that is currently in review in #7240 and this doc should remain separate, yet closely related documents. #7240 is more about showing how this large set of problems discussed in #5000 can all be solved technically, and how those solutions can be used together. It establishes that none of the proposed solutions for components of #5000 will preclude the possibility of other components being solved. What it does _not_ do however is drill too deeply on the user experience that will be built on top of those architectural changes. This doc on the other hand focuses more closely on a pair of scenarios, and establishes how those scenarios will work technically, and how they'll be exposed to the user.
Try this:
|
And what would the commands be to open a new tab from within the terminal itself? |
@zadjii-msft thanks, but it doesn't seem to work from bash (Terminal Preview) 🤷♂️ |
Ah, from WSL you'll need:
Execution aliases do not work in WSL distributions. If you want to use Also, you can read this in the docs |
Beat me to the punch. Yes, it does work in a PowerShell tab. However, it does not work in a Windows Terminal window running as administrator (see #9628). |
Yes indeed i am running Windows terminal as Administrator and I see this issue...However as you said, if I do not run at as administrator, it works just as expected. Thanks for confirming and making it more explicit and clear. |
For those who are kinda new to this: here is how you can do it the easy way.(Works for me in Windows 10 Pro with Windows Terminal(not Preview)) |
Neither "Attach to the most recently used window" nor "Attach to the most recently used window on this desktop" work for me on Windows 11. I am not using the Preview version of Windows Terminal. Any idea what's up? |
Sorry, buddy, no idea. Try checking the above comments (like modifying the registry). I'll update my prev comment, cuz I'm on windows 10. |
Are there plans to launch a new tab in an existing window, but to choose the window based on MRU order? |
This comment was marked as off-topic.
This comment was marked as off-topic.
This comment was marked as off-topic.
This comment was marked as off-topic.
That's not working for me when calling |
Wondering if that is related to #9628. Add this information to that bug so when it's evaluated for 1.14 this scenario will be included in that evaluation. |
Yes, should be same issue as #9628 barring some strange behavior when called by AHK. |
Description of the new feature/enhancement
I have been playing around with Jetbrains Rider, and when i start a console app with that IDE, it runs the console window inside a docked window in the IDE.
So what i was thinking. How cool would it be, if Windows Terminal allows external applications to start a new Console window in the currently running Windows Terminal instance.
That way whether its VisualStudio or Rider, those IDE's can be configured to start a new Console window inside the Windows Terminal instance.
The way i see this working is: I press F5/ctrl-F5 in visual studio, and instead of opening a new cmd console window, a new tab appears in my running Windows Terminal instance.
The text was updated successfully, but these errors were encountered: