terminal/src/cascadia/TerminalApp
Mike Griese fb597ed304
Add support for renaming windows (#9662)
## 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
2021-04-02 16:00:04 +00:00
..
dll Link to WinMM.Lib for PlaySound with 19041 (#9624) 2021-03-26 11:35:17 -05:00
Resources/en-US Add support for renaming windows (#9662) 2021-04-02 16:00:04 +00:00
ActionPaletteItem.cpp Add a simple page for keybindings (#9253) 2021-02-23 23:37:23 +00:00
ActionPaletteItem.h Replace some of our macros to reduce confusion, increase success (#9376) 2021-03-04 11:27:03 -08:00
ActionPaletteItem.idl Teach CommandPalette model to natively support tabs and command lines (#8420) 2020-12-10 00:36:28 +00:00
App.base.h Apply a GDI region to the top level Island window to allow dragging with a single Island (#929) 2019-06-25 13:06:11 -07:00
App.cpp Make Terminal look great in High Contrast (#6833) 2020-07-08 12:08:08 -07:00
App.h Break everything out of App except Xaml platform init (#3465) 2019-11-07 13:10:58 -08:00
App.idl Fix intellisense errors by moving TerminalApp projects around (#6897) 2020-08-20 22:44:37 +00:00
App.xaml Fix rightmost tab corner (#9575) 2021-03-30 21:03:33 +00:00
AppActionHandlers.cpp Add support for renaming windows (#9662) 2021-04-02 16:00:04 +00:00
AppCommandlineArgs.cpp Add splitMode to the args for split-pane (as -D for duplicate) (#9652) 2021-03-29 17:06:05 -05:00
AppCommandlineArgs.h Add splitMode to the args for split-pane (as -D for duplicate) (#9652) 2021-03-29 17:06:05 -05:00
AppKeyBindings.cpp Rename Microsoft.Terminal.TerminalControl to .Control; Split into dll & lib (#9472) 2021-03-17 20:47:24 +00:00
AppKeyBindings.h Rename Microsoft.Terminal.TerminalControl to .Control; Split into dll & lib (#9472) 2021-03-17 20:47:24 +00:00
AppKeyBindings.idl Rename Microsoft.Terminal.TerminalControl to .Control; Split into dll & lib (#9472) 2021-03-17 20:47:24 +00:00
AppLogic.cpp Add support for renaming windows (#9662) 2021-04-02 16:00:04 +00:00
AppLogic.h Add support for renaming windows (#9662) 2021-04-02 16:00:04 +00:00
AppLogic.idl Add support for renaming windows (#9662) 2021-04-02 16:00:04 +00:00
ColorHelper.cpp Fix a few minor typos from #3789 (#5740) 2020-05-04 16:47:29 -05:00
ColorHelper.h Add support for setting a tab's color at runtime w/ context menu (#3789) 2020-05-04 20:57:12 +00:00
ColorPickupFlyout.cpp Add support for setting a tab's color at runtime w/ context menu (#3789) 2020-05-04 20:57:12 +00:00
ColorPickupFlyout.h Add support for setting a tab's color at runtime w/ context menu (#3789) 2020-05-04 20:57:12 +00:00
ColorPickupFlyout.idl Add support for setting a tab's color at runtime w/ context menu (#3789) 2020-05-04 20:57:12 +00:00
ColorPickupFlyout.xaml Auto-format our XAML files and enforce in CI (#9589) 2021-03-29 17:09:38 -05:00
Commandline.cpp Add support for commandline args to wt.exe (#4023) 2020-01-27 15:34:12 +00:00
Commandline.h Add support for commandline args to wt.exe (#4023) 2020-01-27 15:34:12 +00:00
CommandLinePaletteItem.cpp Teach CommandPalette model to natively support tabs and command lines (#8420) 2020-12-10 00:36:28 +00:00
CommandLinePaletteItem.h Replace some of our macros to reduce confusion, increase success (#9376) 2021-03-04 11:27:03 -08:00
CommandLinePaletteItem.idl Teach CommandPalette model to natively support tabs and command lines (#8420) 2020-12-10 00:36:28 +00:00
CommandPalette.cpp Fix wrong item template selection in CmdPal (#9487) 2021-03-24 20:11:35 -05:00
CommandPalette.h Fix wrong item template selection in CmdPal (#9487) 2021-03-24 20:11:35 -05:00
CommandPalette.idl Move Tab Switcher mode handling into CommandPalette (#8656) 2021-01-19 22:18:10 +00:00
CommandPalette.xaml Auto-format our XAML files and enforce in CI (#9589) 2021-03-29 17:09:38 -05:00
DebugTapConnection.cpp Introduce TerminalSettingsModel project (#7667) 2020-10-06 09:56:59 -07:00
DebugTapConnection.h Add explicit identifier to some constructors (#5652) 2020-04-29 16:50:47 -07:00
EmptyStringVisibilityConverter.cpp Add some polish to nested commands in the command palette (#7299) 2020-08-18 19:32:17 +00:00
EmptyStringVisibilityConverter.h Change backslashes in include statements to forward slashes (#8205) 2020-11-25 21:02:10 +00:00
EmptyStringVisibilityConverter.idl Add some polish to nested commands in the command palette (#7299) 2020-08-18 19:32:17 +00:00
FilteredCommand.cpp Teach CommandPalette model to natively support tabs and command lines (#8420) 2020-12-10 00:36:28 +00:00
FilteredCommand.h Replace some of our macros to reduce confusion, increase success (#9376) 2021-03-04 11:27:03 -08:00
FilteredCommand.idl Teach CommandPalette model to natively support tabs and command lines (#8420) 2020-12-10 00:36:28 +00:00
HighlightedText.cpp Bold matching text in the command palette (#7977) 2020-11-05 17:37:45 -08:00
HighlightedText.h Replace some of our macros to reduce confusion, increase success (#9376) 2021-03-04 11:27:03 -08:00
HighlightedText.idl Bold matching text in the command palette (#7977) 2020-11-05 17:37:45 -08:00
HighlightedTextControl.cpp Bold matching text in the command palette (#7977) 2020-11-05 17:37:45 -08:00
HighlightedTextControl.h Bold matching text in the command palette (#7977) 2020-11-05 17:37:45 -08:00
HighlightedTextControl.idl Bold matching text in the command palette (#7977) 2020-11-05 17:37:45 -08:00
HighlightedTextControl.xaml Auto-format our XAML files and enforce in CI (#9589) 2021-03-29 17:09:38 -05:00
IDirectKeyListener.idl Pass the scancode in our tunneled DirectKey event (#7298) 2020-08-14 23:44:39 +00:00
init.cpp Hook up the WIL fallback error tracer in Terminal (#7864) 2020-10-09 22:20:12 +00:00
Jumplist.cpp Store and expose hidden profiles (#8070) 2020-10-28 16:22:26 +00:00
Jumplist.h Move jumplist creation to background thread (#7978) 2020-10-22 17:17:26 -07:00
MinMaxCloseControl.cpp Move events out of TermControl.h ; Use TYPED_EVENT in more places (#9526) 2021-03-18 22:02:39 +00:00
MinMaxCloseControl.h Move events out of TermControl.h ; Use TYPED_EVENT in more places (#9526) 2021-03-18 22:02:39 +00:00
MinMaxCloseControl.idl Fix intellisense errors by moving TerminalApp projects around (#6897) 2020-08-20 22:44:37 +00:00
MinMaxCloseControl.xaml Auto-format our XAML files and enforce in CI (#9589) 2021-03-29 17:09:38 -05:00
packages.config Update C++/WinRT to 2.0.210309.3 (#9437) 2021-03-10 16:04:59 -06:00
PaletteItem.cpp Rename Microsoft.Terminal.TerminalControl to .Control; Split into dll & lib (#9472) 2021-03-17 20:47:24 +00:00
PaletteItem.h Replace some of our macros to reduce confusion, increase success (#9376) 2021-03-04 11:27:03 -08:00
PaletteItem.idl Teach CommandPalette model to natively support tabs and command lines (#8420) 2020-12-10 00:36:28 +00:00
PaletteItemTemplateSelector.cpp Add help text to 'more options' in command palette (#9271) 2021-02-24 12:02:09 -08:00
PaletteItemTemplateSelector.h Replace some of our macros to reduce confusion, increase success (#9376) 2021-03-04 11:27:03 -08:00
PaletteItemTemplateSelector.idl Add help text to 'more options' in command palette (#9271) 2021-02-24 12:02:09 -08:00
Pane.cpp Separate between Close Tab Requested and Tab Closed flows (#9574) 2021-03-30 15:58:35 +00:00
Pane.h Separate between Close Tab Requested and Tab Closed flows (#9574) 2021-03-30 15:58:35 +00:00
Pane.LayoutSizeNode.cpp Snap to character grid when resizing window (#3181) 2020-01-08 13:19:23 -08:00
pch.cpp Initial release of the Windows Terminal source code 2019-05-02 15:29:04 -07:00
pch.h Command Palette: announce various mode and state changes to UIA (#9582) 2021-03-23 08:24:27 -05:00
SettingsTab.cpp Rename Microsoft.Terminal.TerminalControl to .Control; Split into dll & lib (#9472) 2021-03-17 20:47:24 +00:00
SettingsTab.h Add a keybinding option to Terminal to open the Settings UI (#8048) 2020-12-11 13:47:10 -08:00
SettingsTab.idl Add a keybinding option to Terminal to open the Settings UI (#8048) 2020-12-11 13:47:10 -08:00
ShortcutActionDispatch.cpp Add X Macro for fun and for profit (#9667) 2021-03-31 16:38:25 +00:00
ShortcutActionDispatch.h Add X Macro for fun and for profit (#9667) 2021-03-31 16:38:25 +00:00
ShortcutActionDispatch.idl Add X Macro for fun and for profit (#9667) 2021-03-31 16:38:25 +00:00
TabBase.cpp Separate between Close Tab Requested and Tab Closed flows (#9574) 2021-03-30 15:58:35 +00:00
TabBase.h Separate between Close Tab Requested and Tab Closed flows (#9574) 2021-03-30 15:58:35 +00:00
TabBase.idl Introduce read-only panes (#8867) 2021-02-08 18:03:55 +00:00
TabHeaderControl.cpp Prevent arrow keys from dismissing tab renamer (#9633) 2021-03-29 17:23:09 +00:00
TabHeaderControl.h Replace some of our macros to reduce confusion, increase success (#9376) 2021-03-04 11:27:03 -08:00
TabHeaderControl.idl Teach tab to focus terminal after rename (#9162) 2021-02-17 20:00:23 +00:00
TabHeaderControl.xaml Auto-format our XAML files and enforce in CI (#9589) 2021-03-29 17:09:38 -05:00
TabManagement.cpp Separate between Close Tab Requested and Tab Closed flows (#9574) 2021-03-30 15:58:35 +00:00
TabPaletteItem.cpp Fix ATS tab status indicators (#9076) 2021-02-10 11:27:29 +00:00
TabPaletteItem.h Replace some of our macros to reduce confusion, increase success (#9376) 2021-03-04 11:27:03 -08:00
TabPaletteItem.idl Fix ATS tab status indicators (#9076) 2021-02-10 11:27:29 +00:00
TabRowControl.cpp Upgrade to Microsoft.UI.Xaml 2.2 (#3027) 2019-10-14 22:41:43 -07:00
TabRowControl.h Upgrade to Microsoft.UI.Xaml 2.2 (#3027) 2019-10-14 22:41:43 -07:00
TabRowControl.idl Upgrade to Microsoft.UI.Xaml 2.2 (#3027) 2019-10-14 22:41:43 -07:00
TabRowControl.xaml Auto-format our XAML files and enforce in CI (#9589) 2021-03-29 17:09:38 -05:00
TerminalAppLib.vcxproj Add an action for identifying windows (#9523) 2021-03-30 16:08:03 +00:00
TerminalAppLib.vcxproj.filters Move TerminalSettings from TermApp to TerminalSettingsModel (#9318) 2021-03-15 23:15:25 +00:00
TerminalPage.cpp Add support for renaming windows (#9662) 2021-04-02 16:00:04 +00:00
TerminalPage.h Add support for renaming windows (#9662) 2021-04-02 16:00:04 +00:00
TerminalPage.idl Add support for renaming windows (#9662) 2021-04-02 16:00:04 +00:00
TerminalPage.xaml Add support for renaming windows (#9662) 2021-04-02 16:00:04 +00:00
TerminalTab.cpp Separate between Close Tab Requested and Tab Closed flows (#9574) 2021-03-30 15:58:35 +00:00
TerminalTab.h Rename Microsoft.Terminal.TerminalControl to .Control; Split into dll & lib (#9472) 2021-03-17 20:47:24 +00:00
TerminalTab.idl Fix ATS tab status indicators (#9076) 2021-02-10 11:27:29 +00:00
TerminalTabStatus.cpp Fix ATS tab status indicators (#9076) 2021-02-10 11:27:29 +00:00
TerminalTabStatus.h Replace some of our macros to reduce confusion, increase success (#9376) 2021-03-04 11:27:03 -08:00
TerminalTabStatus.idl Fix ATS tab status indicators (#9076) 2021-02-10 11:27:29 +00:00
TitlebarControl.cpp Add support for setting a tab's color at runtime w/ context menu (#3789) 2020-05-04 20:57:12 +00:00
TitlebarControl.h Add support for setting a tab's color at runtime w/ context menu (#3789) 2020-05-04 20:57:12 +00:00
TitlebarControl.idl Upgrade to Microsoft.UI.Xaml 2.2 (#3027) 2019-10-14 22:41:43 -07:00
TitlebarControl.xaml Auto-format our XAML files and enforce in CI (#9589) 2021-03-29 17:09:38 -05:00
Toast.cpp Add an action for identifying windows (#9523) 2021-03-30 16:08:03 +00:00
Toast.h Add an action for identifying windows (#9523) 2021-03-30 16:08:03 +00:00