fb597ed304
## 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
123 lines
5.1 KiB
XML
123 lines
5.1 KiB
XML
<?xml version="1.0" encoding="utf-8"?>
|
|
<Project DefaultTargets="Build" ToolsVersion="15.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
|
<PropertyGroup Label="Globals">
|
|
<ProjectGuid>{43ce4ce5-0010-4b99-9569-672670d26e26}</ProjectGuid>
|
|
<Keyword>Win32Proj</Keyword>
|
|
<ProjectName>Microsoft.Terminal.Remoting.Lib</ProjectName>
|
|
<RootNamespace>Microsoft.Terminal.Remoting</RootNamespace>
|
|
<TargetName>Microsoft.Terminal.Remoting.Lib</TargetName>
|
|
<WindowsTargetPlatformMinVersion>10.0.17763.0</WindowsTargetPlatformMinVersion>
|
|
<ConfigurationType>StaticLibrary</ConfigurationType>
|
|
<SubSystem>Console</SubSystem>
|
|
<OpenConsoleUniversalApp>true</OpenConsoleUniversalApp>
|
|
</PropertyGroup>
|
|
<Import Project="..\..\..\common.openconsole.props" Condition="'$(OpenConsoleDir)'==''" />
|
|
<Import Project="$(OpenConsoleDir)src\cppwinrt.build.pre.props" />
|
|
|
|
<!-- ========================= Headers ======================== -->
|
|
<ItemGroup>
|
|
<ClInclude Include="Monarch.h">
|
|
<DependentUpon>Monarch.idl</DependentUpon>
|
|
</ClInclude>
|
|
<ClInclude Include="FindTargetWindowArgs.h">
|
|
<DependentUpon>Monarch.idl</DependentUpon>
|
|
</ClInclude>
|
|
<ClInclude Include="ProposeCommandlineResult.h">
|
|
<DependentUpon>Monarch.idl</DependentUpon>
|
|
</ClInclude>
|
|
<ClInclude Include="RenameRequestArgs.h">
|
|
<DependentUpon>Peasant.idl</DependentUpon>
|
|
</ClInclude>
|
|
<ClInclude Include="WindowActivatedArgs.h">
|
|
<DependentUpon>Peasant.idl</DependentUpon>
|
|
</ClInclude>
|
|
<ClInclude Include="pch.h" />
|
|
<ClInclude Include="MonarchFactory.h" />
|
|
<ClInclude Include="Peasant.h">
|
|
<DependentUpon>Peasant.idl</DependentUpon>
|
|
</ClInclude>
|
|
<ClInclude Include="WindowManager.h">
|
|
<DependentUpon>WindowManager.idl</DependentUpon>
|
|
</ClInclude>
|
|
<ClInclude Include="CommandlineArgs.h">
|
|
<DependentUpon>Peasant.idl</DependentUpon>
|
|
</ClInclude>
|
|
</ItemGroup>
|
|
<!-- ========================= Cpp Files ======================== -->
|
|
<ItemGroup>
|
|
<ClCompile Include="Monarch.cpp">
|
|
<DependentUpon>Monarch.idl</DependentUpon>
|
|
</ClCompile>
|
|
<ClCompile Include="FindTargetWindowArgs.cpp">
|
|
<DependentUpon>Monarch.idl</DependentUpon>
|
|
</ClCompile>
|
|
<ClCompile Include="ProposeCommandlineResult.cpp">
|
|
<DependentUpon>Monarch.idl</DependentUpon>
|
|
</ClCompile>
|
|
<ClCompile Include="RenameRequestArgs.cpp">
|
|
<DependentUpon>Peasant.idl</DependentUpon>
|
|
</ClCompile>
|
|
<ClCompile Include="WindowActivatedArgs.cpp">
|
|
<DependentUpon>Peasant.idl</DependentUpon>
|
|
</ClCompile>
|
|
<ClCompile Include="pch.cpp">
|
|
<PrecompiledHeader>Create</PrecompiledHeader>
|
|
</ClCompile>
|
|
<ClCompile Include="Peasant.cpp">
|
|
<DependentUpon>Peasant.idl</DependentUpon>
|
|
</ClCompile>
|
|
<ClCompile Include="WindowManager.cpp">
|
|
<DependentUpon>WindowManager.idl</DependentUpon>
|
|
</ClCompile>
|
|
<ClCompile Include="CommandlineArgs.cpp">
|
|
<DependentUpon>Peasant.idl</DependentUpon>
|
|
</ClCompile>
|
|
<ClCompile Include="$(GeneratedFilesDir)module.g.cpp" />
|
|
<ClCompile Include="init.cpp" />
|
|
</ItemGroup>
|
|
<!-- ========================= idl Files ======================== -->
|
|
<ItemGroup>
|
|
<Midl Include="Monarch.idl" />
|
|
<Midl Include="Peasant.idl" />
|
|
<Midl Include="WindowManager.idl" />
|
|
</ItemGroup>
|
|
<!-- ========================= Misc Files ======================== -->
|
|
<ItemGroup>
|
|
<PRIResource Include="Resources\en-US\Resources.resw" />
|
|
<OCResourceDirectory Include="Resources" />
|
|
<None Include="packages.config" />
|
|
</ItemGroup>
|
|
<!-- ========================= Project References ======================== -->
|
|
<ItemGroup>
|
|
<!--
|
|
the packaging project won't recurse through our dependencies, you have to
|
|
make sure that if you add a cppwinrt dependency to any of these projects,
|
|
you also update all the consumers
|
|
-->
|
|
<ProjectReference Include="$(OpenConsoleDir)src\types\lib\types.vcxproj" />
|
|
<ProjectReference Include="$(OpenConsoleDir)src\cascadia\WinRTUtils\WinRTUtils.vcxproj">
|
|
<Project>{CA5CAD1A-039A-4929-BA2A-8BEB2E4106FE}</Project>
|
|
<ReferenceOutputAssembly>false</ReferenceOutputAssembly>
|
|
</ProjectReference>
|
|
<!-- For whatever reason, we can't include the TerminalControl and
|
|
TerminalSettings projects' winmds via project references. So we'll have to
|
|
manually include the winmds as References below -->
|
|
</ItemGroup>
|
|
<!-- ====================== Compiler & Linker Flags ===================== -->
|
|
<ItemDefinitionGroup>
|
|
<ClCompile>
|
|
<PrecompiledHeaderFile>pch.h</PrecompiledHeaderFile>
|
|
</ClCompile>
|
|
<Link>
|
|
<AdditionalDependencies>WindowsApp.lib;user32.lib;shell32.lib;%(AdditionalDependencies)</AdditionalDependencies>
|
|
</Link>
|
|
<Reference>
|
|
<Private>false</Private>
|
|
</Reference>
|
|
</ItemDefinitionGroup>
|
|
<!-- ========================= Globals ======================== -->
|
|
<Import Project="$(OpenConsoleDir)src\cppwinrt.build.post.props" />
|
|
|
|
<Import Project="$(SolutionDir)build\rules\CollectWildcardResources.targets" />
|
|
</Project>
|