Provide a programmatic way to open a program in a new tab #5589

Closed
opened 2026-01-31 00:16:47 +00:00 by claunia · 6 comments
Owner

Originally created by @pfmoore on GitHub (Dec 16, 2019).

Allow the user to open a new tab from the command line

Rather than opening a new tab by selecting an item from the drop-down menu, or pressing a shortcut key, allow the user to open a new tab using a command line. So, for example, to open an instance of Python in a new tab, something like new-tab python. Obviously the exact command name doesn't matter, the key is to have the functionality.

A similar feature is available in ConEmu, where the command line is scanned for a -new_console flag: python -new_console. I'm assuming that intercepting and scanning command lines is messier and less robust than a dedicated command would be. This feature is extremely useful when starting a command that should run "in the background" - for example when starting a Jupyter notebook session.

Proposed technical implementation details

This proposal would probably require exposing a programmatic API to "the currently running instance of terminal". Such an API could in practice have far wider reaching implications than just a "run command in new tab" API, and I understand that it could be a significant feature addition. At this point, though, I would be happy with a limited approach that only offered "open a new tab".

It's also possible that something like this already exists, but I haven't been able to find any documentation or examples of it, if that's the case.

Originally created by @pfmoore on GitHub (Dec 16, 2019). <!-- 🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨 I ACKNOWLEDGE THE FOLLOWING BEFORE PROCEEDING: 1. If I delete this entire template and go my own path, the core team may close my issue without further explanation or engagement. 2. If I list multiple bugs/concerns in this one issue, the core team may close my issue without further explanation or engagement. 3. If I write an issue that has many duplicates, the core team may close my issue without further explanation or engagement (and without necessarily spending time to find the exact duplicate ID number). 4. If I leave the title incomplete when filing the issue, the core team may close my issue without further explanation or engagement. 5. If I file something completely blank in the body, the core team may close my issue without further explanation or engagement. All good? Then proceed! --> # Allow the user to open a new tab from the command line Rather than opening a new tab by selecting an item from the drop-down menu, or pressing a shortcut key, allow the user to open a new tab using a command line. So, for example, to open an instance of Python in a new tab, something like `new-tab python`. Obviously the exact command name doesn't matter, the key is to have the functionality. A similar feature is available in [ConEmu](https://conemu.github.io/), where the command line is scanned for a `-new_console` flag: `python -new_console`. I'm assuming that intercepting and scanning command lines is messier and less robust than a dedicated command would be. This feature is extremely useful when starting a command that should run "in the background" - for example when starting a Jupyter notebook session. # Proposed technical implementation details This proposal would probably require exposing a programmatic API to "the currently running instance of terminal". Such an API could in practice have far wider reaching implications than just a "run command in new tab" API, and I understand that it could be a significant feature addition. At this point, though, I would be happy with a limited approach that only offered "open a new tab". It's also possible that something like this already exists, but I haven't been able to find any documentation or examples of it, if that's the case.
claunia added the Issue-FeatureResolution-Duplicate labels 2026-01-31 00:16:47 +00:00
Author
Owner

@zadjii-msft commented on GitHub (Dec 16, 2019):

Hey thanks for the suggestion! We're actually working on designing this exact request over in #607 and #3495. I'll direct discussion to those threads.

/dup #607

@zadjii-msft commented on GitHub (Dec 16, 2019): Hey thanks for the suggestion! We're actually working on designing this exact request over in #607 and #3495. I'll direct discussion to those threads. /dup #607
Author
Owner

@ghost commented on GitHub (Dec 16, 2019):

Hi! We've identified this issue as a duplicate of another one that already exists on this Issue Tracker. This specific instance is being closed in favor of tracking the concern over on the referenced thread. Thanks for your report!

@ghost commented on GitHub (Dec 16, 2019): Hi! We've identified this issue as a duplicate of another one that already exists on this Issue Tracker. This specific instance is being closed in favor of tracking the concern over on the referenced thread. Thanks for your report!
Author
Owner

@pfmoore commented on GitHub (Dec 16, 2019):

Nice! Thanks for the pointer, I'd missed the other issue :-)

@pfmoore commented on GitHub (Dec 16, 2019): Nice! Thanks for the pointer, I'd missed the other issue :-)
Author
Owner

@pfmoore commented on GitHub (Sep 10, 2020):

Update: Sorry it took me so long to get back to this, but it appears that #607 did not address this issue - that issue as implemented only allows controlling how a new instance gets opened. My request here is for a way to control an already open instance of Windows Terminal. I'd held off coming back here on the assumption that the implementation was "still in progress", but that issue now seems to have been closed and the feature is considered released, but it doesn't do what I asked for.

What I am looking for is a way to (for example) type a command into an existing Terminal instance, and have that command open a new pane alongside the existing one, and run my program in that pane. Here's a couple of screenshots of how the equivalent functionality works in ConEmu:

image

image

I'd be expecting an equivalent command in wt to be something like wt -action split-pane -run py

@zadjii-msft I don't know how to re-open this issue, could you do that please? Or should I open a new issue, explaining my request more clearly?

@pfmoore commented on GitHub (Sep 10, 2020): Update: Sorry it took me so long to get back to this, but it appears that #607 did *not* address this issue - that issue as implemented only allows controlling how a *new* instance gets opened. My request here is for a way to control an *already open* instance of Windows Terminal. I'd held off coming back here on the assumption that the implementation was "still in progress", but that issue now seems to have been closed and the feature is considered released, but it doesn't do what I asked for. What I am looking for is a way to (for example) type a command into an existing Terminal instance, and have that command open a new pane alongside the existing one, and run my program in that pane. Here's a couple of screenshots of how the equivalent functionality works in ConEmu: ![image](https://user-images.githubusercontent.com/1110419/92741357-6f774780-f376-11ea-8ff0-afd1a4199560.png) ![image](https://user-images.githubusercontent.com/1110419/92741391-7b630980-f376-11ea-8985-c9f39ea69d55.png) I'd be expecting an equivalent command in wt to be something like `wt -action split-pane -run py` @zadjii-msft I don't know how to re-open this issue, could you do that please? Or should I open a new issue, explaining my request more clearly?
Author
Owner

@zadjii-msft commented on GitHub (Sep 10, 2020):

@pfmoore Oh, sorry for the misunderstanding. We're tracking that part of this scenario over in #4472 and #5000 now

@zadjii-msft commented on GitHub (Sep 10, 2020): @pfmoore Oh, sorry for the misunderstanding. We're tracking that part of this scenario over in #4472 and #5000 now
Author
Owner

@pfmoore commented on GitHub (Sep 10, 2020):

@zadjii-msft Awesome, thanks for the pointers - and apologies that I didn't manage to find those issues myself.

I'm really impressed with both Windows Terminal itself, and the super responsive and helpful interactions on the tracker here - keep up the good work! 🙂

@pfmoore commented on GitHub (Sep 10, 2020): @zadjii-msft Awesome, thanks for the pointers - and apologies that I didn't manage to find those issues myself. I'm really impressed with both Windows Terminal itself, and the super responsive and helpful interactions on the tracker here - keep up the good work! 🙂
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: starred/terminal#5589