microsoft / microsoft/terminal

Shortcut to create new window with current profile? Equivalently, clone current tab into new window

Open
#14,350 8 comments 2 reactions 0 assignees View on GitHub
Area-Settings Issue-Task Product-Terminal
Dominant language
C++
Stars
105k
Forks
9.6k
Avg merge
3d 17h
Merged PRs (30d)
29

Description

Thank you for your work on the Windows Terminal so far, it's pretty awesome!

# Description of the new feature/enhancement

Support a shortcut to create a new window with current profile / clone current tab into a new window. That is, if the current tab uses my non-default "Debian" profile, pressing this shortcut will open a new window with a single tab of the "Debian" profile.

This would be super useful to enable a window-based approach, with tiled windows, and it would go really well with the "Focus" launch mode. I see this was rationale behind the requests to add the "New Window" shortcut, Ctrl-Shift-N in the first place [#1051, #3144]

# Workarounds

I am describing a few workarounds below:

* Ctrl-Shift-N opens a new window, but it always starts with the *default* profile. I haven't found a way to ask it to use the *current* profile instead.
* I can use the mouse to Shift-click on a profile from the dropdown menu. Plus, I can open the dropdown menu easily using Ctrl-Shift-Space, but it's not a single keystroke.
* I can run `wt.exe -p $WT_PROFILE_ID`, and I can also alias this for my shell, `alias w="wt.exe -p $WT_PROFILE_ID"`, but this only works in Linux, and requires I'm at the shell prompt.

It would be awesome to have a single, easy to use keystroke [Alt-F2? :) ] to duplicate the current profile into a new window.

# Proposed technical implementation details (optional)

There already is a command to start a new window, `newWindow`.
https://learn.microsoft.com/en-us/windows/terminal/customize-settings/actions#window-management-commands

It already accepts `index` and `profile` arguments, but they are absolute. I haven't found a way to refer to the *current* index/profile.
Maybe we could extend `index` and/or `profile` so `-1` means "use the index corresponding to the profile of the current tab".
I'd love any feedback on this, and I would be happy to contribute to the implementation.

Contributor guide

Open the contributing guide

Research direction

Start with the existing `newWindow` command and its `index` and `profile` arguments. Trace how the current tab's profile is represented and how new windows are launched, then determine how a shortcut can pass that current profile without changing existing absolute arguments. Done means a shortcut opens a new window containing one tab using the current tab's profile.

Written by the indexing model from the issue text.

Assessment

Tech stack
cpp
Domain
cli
Issue type
Feature
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.