[PR #9300] [MERGED] Add support for naming windows with the -w parameter #27534

Open
opened 2026-01-31 09:22:32 +00:00 by claunia · 0 comments
Owner

📋 Pull Request Information

Original PR: https://github.com/microsoft/terminal/pull/9300
Author: @zadjii-msft
Created: 2/26/2021
Status: Merged
Merged: 3/17/2021
Merged by: @undefined

Base: mainHead: dev/migrie/f/name-windows-3


📝 Commits (10+)

  • 1c7da00 Rebase all the changes on main
  • 97818c6 fix a bug and fix the tests
  • 2ec9415 fix tests
  • e13e1e7 Good ole Java
  • 136ce6d finish that test
  • 27d12a2 THIS NEEDS TO GO TO THE PARENT
  • c202257 feedback from review
  • eaaa204 initial review feedback
  • 9f54229 Merge remote-tracking branch 'origin/main' into dev/migrie/f/name-windows-3
  • bba09e3 Address PR concerns

📊 Changes

18 files changed (+757 additions, -97 deletions)

View changed files

📝 src/cascadia/LocalTests_TerminalApp/CommandlineTest.cpp (+145 -42)
📝 src/cascadia/Remoting/FindTargetWindowArgs.h (+1 -0)
📝 src/cascadia/Remoting/Monarch.cpp (+63 -2)
📝 src/cascadia/Remoting/Monarch.h (+1 -0)
📝 src/cascadia/Remoting/Monarch.idl (+2 -1)
📝 src/cascadia/Remoting/Peasant.h (+2 -0)
📝 src/cascadia/Remoting/Peasant.idl (+1 -0)
📝 src/cascadia/Remoting/ProposeCommandlineResult.h (+1 -0)
📝 src/cascadia/Remoting/WindowManager.cpp (+59 -7)
📝 src/cascadia/Remoting/WindowManager.h (+2 -1)
📝 src/cascadia/TerminalApp/AppCommandlineArgs.cpp (+5 -11)
📝 src/cascadia/TerminalApp/AppCommandlineArgs.h (+2 -2)
📝 src/cascadia/TerminalApp/AppLogic.cpp (+68 -22)
📝 src/cascadia/TerminalApp/AppLogic.h (+17 -3)
📝 src/cascadia/TerminalApp/AppLogic.idl (+7 -1)
📝 src/cascadia/UnitTests_Remoting/RemotingTests.cpp (+374 -0)
📝 src/cascadia/WindowsTerminal/AppHost.cpp (+2 -1)
📝 src/cascadia/inc/WindowingBehavior.h (+5 -4)

📄 Description

This finishes the implementation of --window to also accept a string
as the "name" of the window. So you can say

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

Validation Steps Performed

Ran tests
Messed with naming windows, working as expected.

Closes https://github.com/microsoft/terminal/projects/5#card-51431478


🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.

## 📋 Pull Request Information **Original PR:** https://github.com/microsoft/terminal/pull/9300 **Author:** [@zadjii-msft](https://github.com/zadjii-msft) **Created:** 2/26/2021 **Status:** ✅ Merged **Merged:** 3/17/2021 **Merged by:** [@undefined](undefined) **Base:** `main` ← **Head:** `dev/migrie/f/name-windows-3` --- ### 📝 Commits (10+) - [`1c7da00`](https://github.com/microsoft/terminal/commit/1c7da000fcacc1e076d4538316435b873db3ee90) Rebase all the changes on main - [`97818c6`](https://github.com/microsoft/terminal/commit/97818c68e608b96de2eecf44ac7f3007eff98dd0) fix a bug and fix the tests - [`2ec9415`](https://github.com/microsoft/terminal/commit/2ec94159746125a0b28a4ee38ee1dbb0740169d8) fix tests - [`e13e1e7`](https://github.com/microsoft/terminal/commit/e13e1e7fe55657b084a41d4860df26ec80c97f22) Good ole Java - [`136ce6d`](https://github.com/microsoft/terminal/commit/136ce6d983c8b2b7031576f54d760e7999cf35d7) finish that test - [`27d12a2`](https://github.com/microsoft/terminal/commit/27d12a2a923611e0f9a80f5dbacef20395afcdd3) THIS NEEDS TO GO TO THE PARENT - [`c202257`](https://github.com/microsoft/terminal/commit/c2022573abeaa48f8488fc3fb48b9371758343ba) feedback from review - [`eaaa204`](https://github.com/microsoft/terminal/commit/eaaa2044c4dfd3999f00564036a53b162b01dc23) initial review feedback - [`9f54229`](https://github.com/microsoft/terminal/commit/9f54229d795d876fc2deec6726eada155638edfd) Merge remote-tracking branch 'origin/main' into dev/migrie/f/name-windows-3 - [`bba09e3`](https://github.com/microsoft/terminal/commit/bba09e3f8b9db79bc40f685dd962168dd0678d7d) Address PR concerns ### 📊 Changes **18 files changed** (+757 additions, -97 deletions) <details> <summary>View changed files</summary> 📝 `src/cascadia/LocalTests_TerminalApp/CommandlineTest.cpp` (+145 -42) 📝 `src/cascadia/Remoting/FindTargetWindowArgs.h` (+1 -0) 📝 `src/cascadia/Remoting/Monarch.cpp` (+63 -2) 📝 `src/cascadia/Remoting/Monarch.h` (+1 -0) 📝 `src/cascadia/Remoting/Monarch.idl` (+2 -1) 📝 `src/cascadia/Remoting/Peasant.h` (+2 -0) 📝 `src/cascadia/Remoting/Peasant.idl` (+1 -0) 📝 `src/cascadia/Remoting/ProposeCommandlineResult.h` (+1 -0) 📝 `src/cascadia/Remoting/WindowManager.cpp` (+59 -7) 📝 `src/cascadia/Remoting/WindowManager.h` (+2 -1) 📝 `src/cascadia/TerminalApp/AppCommandlineArgs.cpp` (+5 -11) 📝 `src/cascadia/TerminalApp/AppCommandlineArgs.h` (+2 -2) 📝 `src/cascadia/TerminalApp/AppLogic.cpp` (+68 -22) 📝 `src/cascadia/TerminalApp/AppLogic.h` (+17 -3) 📝 `src/cascadia/TerminalApp/AppLogic.idl` (+7 -1) 📝 `src/cascadia/UnitTests_Remoting/RemotingTests.cpp` (+374 -0) 📝 `src/cascadia/WindowsTerminal/AppHost.cpp` (+2 -1) 📝 `src/cascadia/inc/WindowingBehavior.h` (+5 -4) </details> ### 📄 Description 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 --- <sub>🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.</sub>
claunia added the pull-request label 2026-01-31 09:22:32 +00:00
Sign in to join this conversation.
No Label pull-request
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: starred/terminal#27534