Add protocol handler to open new tab in existing Windows Terminal #12437

Open
opened 2026-01-31 03:15:37 +00:00 by claunia · 0 comments
Owner

Originally created by @awakecoding on GitHub (Feb 6, 2021).

Description of the new feature/enhancement

Add a protocol handler (winterm://) to allow opening a new tab inside the existing Windows Terminal, instead of opening a new Windows Terminal. The current "Open in Windows Terminal" contextual menu option unfortunately always open a new Windows Terminal, instead of adding a new tab to the current one. The goal is to make it easier for third-party programs to implement richer "Open in Windows Terminal" functionality, where a new tab with a special profile is opened with an initial command injected. In our case, we intend to launch PowerShell remoting sessions from Remote Desktop Manager inside Windows Terminal. We currently supported embedded tabs inside Remote Desktop Manager, or we can launch the old boring blue PowerShell terminal externally. Since the old PowerShell terminal doesn't support tabs anyway, it has never been an issue.

Proposed technical implementation details

Regardless of the final name for the protocol handler (I suggest winterm://) the implementation is relatively simple: on startup, you check for the presence of an existing Windows Terminal instance. If there is one, you send the URL string passed through the protocol handler to the other process, and terminate. The receiving instance receives the URL and processes it to open a new tab with the specified profile id. We have implemented something like this to open new connections in our remote desktop program.

the URL string should contain at a bare minimum a profile id, and accept additional parameters following the same format found in settings.json:

winterm://34a13805-9b56-5e89-9234-f02de44bd971?name=Name?command=Command

Since addition parameters like the name and the command will likely contain characters causing trouble, I suggest that we either URL-encode them, or define them to always be encoded as UTF-8 base64url strings, whichever feels best.

The ideal solution would be to support temporary profiles, such that if the profile id doesn't exist, it could be created on-the-fly with all the parameters passed. This would be very useful as external programs could inject meaningful names, and even give a path to an icon file to use. In our case, system administrators can manage thousands of entries in Remote Desktop Manager, so everything that makes it easier to give identifying or distinctive information is a big win.

If we can have such a mechanism in place, we have everything we need for a possible integration, and nothing prevents other vendors from offering similar integration with relatively little effort. The good news is that it would also be relatively decoupled from Windows Terminal.

Originally created by @awakecoding on GitHub (Feb 6, 2021). # Description of the new feature/enhancement Add a protocol handler (winterm://) to allow opening a new tab inside the existing Windows Terminal, instead of opening a new Windows Terminal. The current "Open in Windows Terminal" contextual menu option unfortunately always open a new Windows Terminal, instead of adding a new tab to the current one. The goal is to make it easier for third-party programs to implement richer "Open in Windows Terminal" functionality, where a new tab with a special profile is opened with an initial command injected. In our case, we intend to launch PowerShell remoting sessions from Remote Desktop Manager inside Windows Terminal. We currently supported embedded tabs inside Remote Desktop Manager, or we can launch the old boring blue PowerShell terminal externally. Since the old PowerShell terminal doesn't support tabs anyway, it has never been an issue. # Proposed technical implementation details Regardless of the final name for the protocol handler (I suggest winterm://) the implementation is relatively simple: on startup, you check for the presence of an existing Windows Terminal instance. If there is one, you send the URL string passed through the protocol handler to the other process, and terminate. The receiving instance receives the URL and processes it to open a new tab with the specified profile id. We have implemented something like this to open new connections in our remote desktop program. the URL string should contain at a bare minimum a profile id, and accept additional parameters following the same format found in settings.json: winterm://34a13805-9b56-5e89-9234-f02de44bd971?name=Name?command=Command Since addition parameters like the name and the command will likely contain characters causing trouble, I suggest that we either URL-encode them, or define them to always be encoded as UTF-8 base64url strings, whichever feels best. The ideal solution would be to support temporary profiles, such that if the profile id doesn't exist, it could be created on-the-fly with all the parameters passed. This would be very useful as external programs could inject meaningful names, and even give a path to an icon file to use. In our case, system administrators can manage thousands of entries in Remote Desktop Manager, so everything that makes it easier to give identifying or distinctive information is a big win. If we can have such a mechanism in place, we have everything we need for a possible integration, and nothing prevents other vendors from offering similar integration with relatively little effort. The good news is that it would also be relatively decoupled from Windows Terminal.
claunia added the Issue-FeatureResolution-Duplicate labels 2026-01-31 03:15:38 +00:00
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: starred/terminal#12437