[PR #9662] [MERGED] Add support for renaming windows #27690

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

📋 Pull Request Information

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

Base: mainHead: dev/migrie/f/rename-windows


📝 Commits (10+)

📊 Changes

31 files changed (+679 additions, -13 deletions)

View changed files

📝 doc/cascadia/profiles.schema.json (+36 -0)
📝 src/cascadia/LocalTests_TerminalApp/TabTests.cpp (+56 -0)
📝 src/cascadia/LocalTests_TerminalApp/pch.h (+1 -0)
📝 src/cascadia/Remoting/Microsoft.Terminal.RemotingLib.vcxproj (+6 -0)
📝 src/cascadia/Remoting/Monarch.cpp (+49 -0)
📝 src/cascadia/Remoting/Monarch.h (+6 -2)
📝 src/cascadia/Remoting/Peasant.cpp (+30 -0)
📝 src/cascadia/Remoting/Peasant.h (+3 -0)
📝 src/cascadia/Remoting/Peasant.idl (+10 -0)
src/cascadia/Remoting/RenameRequestArgs.cpp (+5 -0)
src/cascadia/Remoting/RenameRequestArgs.h (+30 -0)
📝 src/cascadia/TerminalApp/AppActionHandlers.cpp (+43 -0)
📝 src/cascadia/TerminalApp/AppLogic.cpp (+9 -0)
📝 src/cascadia/TerminalApp/AppLogic.h (+2 -0)
📝 src/cascadia/TerminalApp/AppLogic.idl (+2 -0)
📝 src/cascadia/TerminalApp/Resources/en-US/Resources.resw (+16 -1)
📝 src/cascadia/TerminalApp/TerminalPage.cpp (+71 -2)
📝 src/cascadia/TerminalApp/TerminalPage.h (+16 -0)
📝 src/cascadia/TerminalApp/TerminalPage.idl (+7 -0)
📝 src/cascadia/TerminalApp/TerminalPage.xaml (+17 -1)

...and 11 more files

📄 Description

Summary of the Pull Request

This PR adds support for renaming windows.

window-renaming-000
window-renaming-001

It does so through two new actions:

  • renameWindow takes a name parameter, and attempts to set the window's name
    to the provided name. This is useful if you always want to hit F3
    and rename a window to "foo" (READ: probably not that useful)
  • openWindowRenamer is more interesting: it opens a TeachingTip with a
    TextBox. When the user hits Ok, it'll request a rename for the provided
    value. This lets the user pick a new name for the window at runtime.

In both cases, if there's already a window with that name, then the monarch will
reject the rename, and pop a Toast in the window informing the user that the
rename failed. Nifty!

References

  • Builds on the toasts from #9523
  • #5000 - process model megathread

PR Checklist

Detailed Description of the Pull Request / Additional comments

I'm sending this PR while finishing up the tests. I figured I'll have time to sneak them in before I get the necessary reviews.

PAIN: We can't immediately focus the textbox in the TeachingTip. It's
not technically focusable until it is opened. However, it doesn't
provide an even tto tell us when it is opened. That's tracked in
microsoft/microsoft-ui-xaml#1607. So for now, the user needs to
click on the text box manually.
We're also not using a ContentDialog for this, because in Xaml
Islands a text box in a ContentDialog won't recieve any keypresses.
Fun!

Validation Steps Performed

I've been playing with

        { "keys": "f1", "command": "identifyWindow" },
        { "keys": "f2", "command": "identifyWindows" },
        { "keys": "f3", "command": "openWindowRenamer" },
        { "keys": "f4", "command": { "action": "renameWindow", "name": "foo" } },
        { "keys": "f5", "command": { "action": "renameWindow", "name": "bar" } },

and they seem to work as expected


🔄 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/9662 **Author:** [@zadjii-msft](https://github.com/zadjii-msft) **Created:** 3/30/2021 **Status:** ✅ Merged **Merged:** 4/2/2021 **Merged by:** [@undefined](undefined) **Base:** `main` ← **Head:** `dev/migrie/f/rename-windows` --- ### 📝 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 - [`ec97c43`](https://github.com/microsoft/terminal/commit/ec97c43af43b67e099981ae3ad87578bca1ab843) macros are life - [`fa26f7f`](https://github.com/microsoft/terminal/commit/fa26f7f569ad843997cff960590d4abfcf38f1b3) THIS NEEDS TO GO TO THE PARENT - [`a391455`](https://github.com/microsoft/terminal/commit/a391455410f7f242c82670405526a5bd74ed589f) Plumb the events up and down - [`001f545`](https://github.com/microsoft/terminal/commit/001f545b9f482e16476fdc93c38729155d4b87dd) Bind the labels to the actual TerminalPage object - [`9270e0f`](https://github.com/microsoft/terminal/commit/9270e0fce3ecd03b124445ac8b7a37991b28f719) bind the name, id down to the actual page ### 📊 Changes **31 files changed** (+679 additions, -13 deletions) <details> <summary>View changed files</summary> 📝 `doc/cascadia/profiles.schema.json` (+36 -0) 📝 `src/cascadia/LocalTests_TerminalApp/TabTests.cpp` (+56 -0) 📝 `src/cascadia/LocalTests_TerminalApp/pch.h` (+1 -0) 📝 `src/cascadia/Remoting/Microsoft.Terminal.RemotingLib.vcxproj` (+6 -0) 📝 `src/cascadia/Remoting/Monarch.cpp` (+49 -0) 📝 `src/cascadia/Remoting/Monarch.h` (+6 -2) 📝 `src/cascadia/Remoting/Peasant.cpp` (+30 -0) 📝 `src/cascadia/Remoting/Peasant.h` (+3 -0) 📝 `src/cascadia/Remoting/Peasant.idl` (+10 -0) ➕ `src/cascadia/Remoting/RenameRequestArgs.cpp` (+5 -0) ➕ `src/cascadia/Remoting/RenameRequestArgs.h` (+30 -0) 📝 `src/cascadia/TerminalApp/AppActionHandlers.cpp` (+43 -0) 📝 `src/cascadia/TerminalApp/AppLogic.cpp` (+9 -0) 📝 `src/cascadia/TerminalApp/AppLogic.h` (+2 -0) 📝 `src/cascadia/TerminalApp/AppLogic.idl` (+2 -0) 📝 `src/cascadia/TerminalApp/Resources/en-US/Resources.resw` (+16 -1) 📝 `src/cascadia/TerminalApp/TerminalPage.cpp` (+71 -2) 📝 `src/cascadia/TerminalApp/TerminalPage.h` (+16 -0) 📝 `src/cascadia/TerminalApp/TerminalPage.idl` (+7 -0) 📝 `src/cascadia/TerminalApp/TerminalPage.xaml` (+17 -1) _...and 11 more files_ </details> ### 📄 Description ## Summary of the Pull Request This PR adds support for renaming windows. ![window-renaming-000](https://user-images.githubusercontent.com/18356694/113034344-9a30be00-9157-11eb-9443-975f3c294f56.gif) ![window-renaming-001](https://user-images.githubusercontent.com/18356694/113034452-b5033280-9157-11eb-9e35-e5ac80fef0bc.gif) It does so through two new actions: * `renameWindow` takes a `name` parameter, and attempts to set the window's name to the provided name. This is useful if you always want to hit <kbd>F3</kbd> and rename a window to "foo" (READ: probably not that useful) * `openWindowRenamer` is more interesting: it opens a `TeachingTip` with a `TextBox`. When the user hits Ok, it'll request a rename for the provided value. This lets the user pick a new name for the window at runtime. In both cases, if there's already a window with that name, then the monarch will reject the rename, and pop a `Toast` in the window informing the user that the rename failed. Nifty! ## References * Builds on the toasts from #9523 * #5000 - process model megathread ## PR Checklist * [x] Closes https://github.com/microsoft/terminal/projects/5#card-50771747 * [x] I work here * [x] Tests addded (and pass with the help of #9660) * [ ] Requires documentation to be updated ## Detailed Description of the Pull Request / Additional comments I'm sending this PR while finishing up the tests. I figured I'll have time to sneak them in before I get the necessary reviews. > PAIN: We can't immediately focus the textbox in the TeachingTip. It's > not technically focusable until it is opened. However, it doesn't > provide an even tto tell us when it is opened. That's tracked in > microsoft/microsoft-ui-xaml#1607. So for now, the user _needs_ to > click on the text box manually. > We're also not using a ContentDialog for this, because in Xaml > Islands a text box in a ContentDialog won't recieve _any_ keypresses. > Fun! ## Validation Steps Performed I've been playing with ```json { "keys": "f1", "command": "identifyWindow" }, { "keys": "f2", "command": "identifyWindows" }, { "keys": "f3", "command": "openWindowRenamer" }, { "keys": "f4", "command": { "action": "renameWindow", "name": "foo" } }, { "keys": "f5", "command": { "action": "renameWindow", "name": "bar" } }, ``` and they seem to work as expected --- <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:23: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#27690