Skip to content

Commit 77e8ca9

Browse files
Revert "Add support for "workspaces" based on window names (#20162)" (#20291)
This reverts commit 4b8b6ff: Add support for "workspaces" based on window names (#20162) @DHowett found the following blocking issues: - #20162 (comment) - unrelated changes in `tools/runformat.cmd` and `OpenConsole.psm1`
1 parent 4b8b6ff commit 77e8ca9

39 files changed

Lines changed: 19 additions & 1021 deletions

doc/cascadia/profiles.schema.json

Lines changed: 0 additions & 32 deletions
Original file line numberDiff line numberDiff line change
@@ -441,7 +441,6 @@
441441
"openTabColorPicker",
442442
"openTabRenamer",
443443
"openWindowRenamer",
444-
"openWorkspace",
445444
"paste",
446445
"prevTab",
447446
"quakeMode",
@@ -480,7 +479,6 @@
480479
"toggleReadOnlyMode",
481480
"toggleShaderEffects",
482481
"toggleSplitOrientation",
483-
"workspaces",
484482
"wt",
485483
"unbound"
486484
],
@@ -1723,28 +1721,6 @@
17231721
}
17241722
]
17251723
},
1726-
"OpenWorkspaceAction": {
1727-
"description": "Arguments corresponding to an openWorkspace Action",
1728-
"allOf": [
1729-
{
1730-
"$ref": "#/$defs/ShortcutAction"
1731-
},
1732-
{
1733-
"type": "object",
1734-
"properties": {
1735-
"action": {
1736-
"type": "string",
1737-
"const": "openWorkspace"
1738-
},
1739-
"name": {
1740-
"type": "string",
1741-
"default": "",
1742-
"description": "The name of the workspace to open. If omitted, the workspaces UI will be shown so the user can pick one."
1743-
}
1744-
}
1745-
}
1746-
]
1747-
},
17481724
"FocusPaneAction": {
17491725
"description": "Arguments corresponding to a focusPane Action",
17501726
"allOf": [
@@ -2064,11 +2040,6 @@
20642040
"unfocusedFrame": {
20652041
"description": "The color of the window frame when the window is inactive. This only works on Windows 11",
20662042
"$ref": "#/$defs/ThemeColor"
2067-
},
2068-
"showWorkspacesButton": {
2069-
"description": "When set to true, the workspaces button will be shown in the tab row.",
2070-
"type": "boolean",
2071-
"default": true
20722043
}
20732044
}
20742045
},
@@ -2237,9 +2208,6 @@
22372208
{
22382209
"$ref": "#/$defs/RenameWindowAction"
22392210
},
2240-
{
2241-
"$ref": "#/$defs/OpenWorkspaceAction"
2242-
},
22432211
{
22442212
"$ref": "#/$defs/FocusPaneAction"
22452213
},

src/cascadia/TerminalApp/AppActionHandlers.cpp

Lines changed: 0 additions & 56 deletions
Original file line numberDiff line numberDiff line change
@@ -938,30 +938,6 @@ namespace winrt::TerminalApp::implementation
938938
co_return;
939939
}
940940

941-
// Launch `wt -w <name>` so the monarch can either summon an existing
942-
// window with that name or restore a persisted workspace.
943-
safe_void_coroutine TerminalPage::_OpenWorkspaceWindow(const winrt::hstring name)
944-
{
945-
co_await winrt::resume_background();
946-
947-
const auto exePath{ GetWtExePath() };
948-
// Quote/escape the window name so that ShellExecute -> CommandLineToArgvW
949-
// round-trips it as a single argument even when it contains spaces or
950-
// other characters that need escaping.
951-
const auto cmdline = fmt::format(FMT_COMPILE(L"-w {}"), QuoteAndEscapeCommandlineArg(std::wstring_view{ name }));
952-
953-
SHELLEXECUTEINFOW seInfo{ 0 };
954-
seInfo.cbSize = sizeof(seInfo);
955-
seInfo.fMask = SEE_MASK_NOASYNC;
956-
seInfo.lpVerb = L"open";
957-
seInfo.lpFile = exePath.c_str();
958-
seInfo.lpParameters = cmdline.c_str();
959-
seInfo.nShow = SW_SHOWNORMAL;
960-
LOG_IF_WIN32_BOOL_FALSE(ShellExecuteExW(&seInfo));
961-
962-
co_return;
963-
}
964-
965941
void TerminalPage::_HandleNewWindow(const IInspectable& /*sender*/,
966942
const ActionEventArgs& actionArgs)
967943
{
@@ -1082,7 +1058,6 @@ namespace winrt::TerminalApp::implementation
10821058
// Fun!
10831059
// WindowRenamerTextBox().Focus(FocusState::Programmatic);
10841060
_renamerLayoutUpdatedRevoker.revoke();
1085-
_renamerLayoutCount = 0;
10861061
_renamerLayoutUpdatedRevoker = WindowRenamerTextBox().LayoutUpdated(winrt::auto_revoke, [weakThis = get_weak()](auto&&, auto&&) {
10871062
if (auto self{ weakThis.get() })
10881063
{
@@ -1658,35 +1633,4 @@ namespace winrt::TerminalApp::implementation
16581633
args.Handled(handled);
16591634
}
16601635
}
1661-
1662-
void TerminalPage::_HandleOpenWorkspace(const IInspectable& /*sender*/,
1663-
const ActionEventArgs& args)
1664-
{
1665-
// Open (or summon) a named window. We launch a new `wt -w <name>`
1666-
// process which the monarch will route to the correct live window or
1667-
// restore from a persisted workspace.
1668-
if (args)
1669-
{
1670-
if (const auto& realArgs = args.ActionArgs().try_as<OpenWorkspaceArgs>())
1671-
{
1672-
const auto name = realArgs.Name();
1673-
if (!name.empty())
1674-
{
1675-
_OpenWorkspaceWindow(name);
1676-
}
1677-
args.Handled(true);
1678-
}
1679-
}
1680-
}
1681-
1682-
void TerminalPage::_HandleWorkspaces(const IInspectable& /*sender*/,
1683-
const ActionEventArgs& args)
1684-
{
1685-
if (_workspaceFlyout && _workspaceDropdown)
1686-
{
1687-
_workspaceFlyout.ShowAt(_workspaceDropdown);
1688-
}
1689-
args.Handled(true);
1690-
}
1691-
16921636
}

src/cascadia/TerminalApp/Pane.cpp

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -92,10 +92,6 @@ INewContentArgs Pane::GetTerminalArgsForPane(BuildStartupKind kind) const
9292
{
9393
// Leaves are the only things that have controls
9494
assert(_IsLeaf());
95-
if (!_content)
96-
{
97-
return nullptr;
98-
}
9995
return _content.GetNewTerminalArgs(kind);
10096
}
10197

src/cascadia/TerminalApp/Remoting.h

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -85,7 +85,6 @@ namespace winrt::TerminalApp::implementation
8585
WINRT_PROPERTY(TerminalApp::CommandlineArgs, Command, nullptr);
8686
WINRT_PROPERTY(winrt::hstring, Content);
8787
WINRT_PROPERTY(Windows::Foundation::IReference<Windows::Foundation::Rect>, InitialBounds);
88-
WINRT_PROPERTY(winrt::Microsoft::Terminal::Settings::Model::WindowLayout, PersistedLayout, nullptr);
8988
};
9089
}
9190

src/cascadia/TerminalApp/Remoting.idl

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -51,6 +51,5 @@ namespace TerminalApp
5151
CommandlineArgs Command { get; };
5252
String Content { get; };
5353
Windows.Foundation.IReference<Windows.Foundation.Rect> InitialBounds { get; };
54-
Microsoft.Terminal.Settings.Model.WindowLayout PersistedLayout;
5554
};
5655
}

src/cascadia/TerminalApp/Resources/en-US/Resources.resw

Lines changed: 0 additions & 39 deletions
Original file line numberDiff line numberDiff line change
@@ -743,42 +743,6 @@
743743
<value>unnamed window</value>
744744
<comment>text used to identify when a window hasn't been assigned a name by the user</comment>
745745
</data>
746-
<data name="NameThisWindowMenuItem" xml:space="preserve">
747-
<value>Name this window...</value>
748-
<comment>Menu item text shown when the current window has no name assigned</comment>
749-
</data>
750-
<data name="RenameThisWindowMenuItem" xml:space="preserve">
751-
<value>Rename this window...</value>
752-
<comment>Menu item text shown when the current window already has a name</comment>
753-
</data>
754-
<data name="WindowListUnnamedEntry" xml:space="preserve">
755-
<value>#{0} (unnamed)</value>
756-
<comment>{locked="{0}"}{0} is the window ID number. Shown in the workspace flyout for windows that have no name assigned.</comment>
757-
</data>
758-
<data name="DeleteWorkspaceMenuItem" xml:space="preserve">
759-
<value>Delete workspace?</value>
760-
<comment>Menu item text shown in the right-click context menu on a saved workspace</comment>
761-
</data>
762-
<data name="OpenWorkspaceMenuItem" xml:space="preserve">
763-
<value>Open workspace</value>
764-
<comment>Menu item text for opening a saved workspace</comment>
765-
</data>
766-
<data name="ConfirmDeleteWorkspaceTitle" xml:space="preserve">
767-
<value>Delete "{0}"?</value>
768-
<comment>{locked="{0}"}{0} is the workspace name. Shown as the title of a confirmation dialog when the user tries to delete a saved workspace.</comment>
769-
</data>
770-
<data name="ConfirmDeleteWorkspaceBody" xml:space="preserve">
771-
<value>Are you sure you want to delete "{0}"? Sessions associated with this workspace will also be deleted.</value>
772-
<comment>{locked="{0}"}{0} is the workspace name. Body text of the confirmation dialog shown when the user tries to delete a saved workspace.</comment>
773-
</data>
774-
<data name="ConfirmDeleteWorkspaceDelete" xml:space="preserve">
775-
<value>Delete</value>
776-
<comment>Primary button text on the delete workspace confirmation dialog</comment>
777-
</data>
778-
<data name="ConfirmDeleteWorkspaceCancel" xml:space="preserve">
779-
<value>Cancel</value>
780-
<comment>Cancel button text on the delete workspace confirmation dialog</comment>
781-
</data>
782746
<data name="WindowRenamer.Subtitle" xml:space="preserve">
783747
<value>Enter a new name:</value>
784748
</data>
@@ -837,9 +801,6 @@
837801
<data name="ElevationShield.[using:Windows.UI.Xaml.Controls]ToolTipService.ToolTip" xml:space="preserve">
838802
<value>This Terminal window is running as administrator</value>
839803
</data>
840-
<data name="WorkspaceDropdown.[using:Windows.UI.Xaml.Controls]ToolTipService.ToolTip" xml:space="preserve">
841-
<value>Workspaces</value>
842-
</data>
843804
<data name="CommandPalette_MatchesAvailable" xml:space="preserve">
844805
<value>Suggestions found: {0}</value>
845806
<comment>{0} will be replaced with a number.</comment>

src/cascadia/TerminalApp/TabManagement.cpp

Lines changed: 0 additions & 46 deletions
Original file line numberDiff line numberDiff line change
@@ -403,22 +403,6 @@ namespace winrt::TerminalApp::implementation
403403
_previouslyClosedPanesAndTabs.emplace_back(args);
404404
}
405405

406-
// Method Description:
407-
// - If this window has a name, persist its current workspace layout to
408-
// ApplicationState. Intended to be called from the close-pane / close-tab
409-
// paths while tab/pane content is still alive (before it gets torn down).
410-
void TerminalPage::_SaveWorkspaceIfNeeded()
411-
{
412-
const auto& windowName = _WindowProperties.WindowName();
413-
if (!windowName.empty())
414-
{
415-
if (const auto layout = GetWindowLayout())
416-
{
417-
ApplicationState::SharedInstance().SaveWorkspace(windowName, layout);
418-
}
419-
}
420-
}
421-
422406
// Method Description:
423407
// - Removes the tab (both TerminalControl and XAML) after prompting for approval
424408
// Arguments:
@@ -466,14 +450,6 @@ namespace winrt::TerminalApp::implementation
466450
auto actions = t->BuildStartupActions(BuildStartupKind::None);
467451
_AddPreviouslyClosedPaneOrTab(std::move(actions));
468452

469-
// If this is the last tab in a named window, persist the workspace
470-
// layout now while tab content is still alive. After tab.Close()
471-
// the pane content will be torn down by the time _RemoveTab runs.
472-
if (_tabs.Size() == 1)
473-
{
474-
_SaveWorkspaceIfNeeded();
475-
}
476-
477453
tab.Close();
478454
}
479455

@@ -495,13 +471,6 @@ namespace winrt::TerminalApp::implementation
495471

496472
const auto focusedTabIndex{ _GetFocusedTabIndex() };
497473

498-
// NOTE: Workspace persistence for named windows used to live here,
499-
// but by the time _RemoveTab runs the pane content may already be
500-
// torn down (e.g. from the close-pane path). Instead, workspace
501-
// saves are handled earlier:
502-
// - Close-pane (last pane): in _HandleClosePaneRequested
503-
// - Close-tab: in _HandleCloseTabRequested
504-
505474
// Removing the tab from the collection should destroy its control and disconnect its connection,
506475
// but it doesn't always do so. The UI tree may still be holding the control and preventing its destruction.
507476
tab.Shutdown();
@@ -829,21 +798,6 @@ namespace winrt::TerminalApp::implementation
829798
}
830799
_AddPreviouslyClosedPaneOrTab(std::move(state.args));
831800

832-
// If this is the last pane on the last tab of a named window, persist
833-
// the workspace layout now while the pane content is still alive.
834-
// We can't wait until _RemoveTab, because pane->Close() below will
835-
// destroy the content before _RemoveTab is reached.
836-
if (_tabs.Size() == 1)
837-
{
838-
if (const auto activeTab{ _GetFocusedTabImpl() })
839-
{
840-
if (activeTab->GetLeafPaneCount() == 1)
841-
{
842-
_SaveWorkspaceIfNeeded();
843-
}
844-
}
845-
}
846-
847801
// If specified, detach before closing to directly update the pane structure
848802
pane->Close();
849803
}

src/cascadia/TerminalApp/TabRowControl.h

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -19,8 +19,6 @@ namespace winrt::TerminalApp::implementation
1919

2020
til::property_changed_event PropertyChanged;
2121
WINRT_OBSERVABLE_PROPERTY(bool, ShowElevationShield, PropertyChanged.raise, false);
22-
WINRT_OBSERVABLE_PROPERTY(bool, ShowWorkspacesButton, PropertyChanged.raise, true);
23-
WINRT_OBSERVABLE_PROPERTY(winrt::hstring, WorkspaceName, PropertyChanged.raise, L"");
2422
};
2523
}
2624

src/cascadia/TerminalApp/TabRowControl.idl

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,5 @@ namespace TerminalApp
99
TabRowControl();
1010
Microsoft.UI.Xaml.Controls.TabView TabView { get; };
1111
Boolean ShowElevationShield;
12-
Boolean ShowWorkspacesButton;
13-
String WorkspaceName;
1412
}
1513
}

src/cascadia/TerminalApp/TabRowControl.xaml

Lines changed: 8 additions & 40 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,6 @@
88
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
99
xmlns:local="using:TerminalApp"
1010
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
11-
xmlns:mtu="using:Microsoft.Terminal.UI"
1211
xmlns:mux="using:Microsoft.UI.Xaml.Controls"
1312
Background="{ThemeResource TabViewBackground}"
1413
mc:Ignorable="d">
@@ -36,45 +35,14 @@
3635
TabWidthMode="Equal">
3736

3837
<mux:TabView.TabStripHeader>
39-
<StackPanel Orientation="Horizontal">
40-
<!-- EA18 is the "Shield" glyph -->
41-
<FontIcon x:Uid="ElevationShield"
42-
Margin="9,4,0,4"
43-
FontFamily="{ThemeResource SymbolThemeFontFamily}"
44-
FontSize="16"
45-
Foreground="{ThemeResource SystemControlForegroundBaseMediumBrush}"
46-
Glyph="&#xEA18;"
47-
Visibility="{x:Bind ShowElevationShield, Mode=OneWay}" />
48-
49-
<!-- Workspace/windows button -->
50-
<Button x:Name="WorkspaceDropdown"
51-
x:Uid="WorkspaceDropdown"
52-
Margin="4,0,0,4"
53-
Padding="8,0,0,0"
54-
VerticalAlignment="Stretch"
55-
Background="Transparent"
56-
BorderThickness="0"
57-
Visibility="{x:Bind ShowWorkspacesButton, Mode=OneWay}">
58-
<Button.Content>
59-
<StackPanel Orientation="Horizontal"
60-
Spacing="8">
61-
<!-- EE40 is the "TaskViewSettings" glyph -->
62-
<FontIcon FontFamily="{ThemeResource SymbolThemeFontFamily}"
63-
FontSize="12"
64-
Glyph="&#xEE40;" />
65-
<TextBlock x:Name="WorkspaceNameText"
66-
Padding="0,0,8,0"
67-
VerticalAlignment="Center"
68-
FontSize="12"
69-
Text="{x:Bind WorkspaceName, Mode=OneWay}"
70-
Visibility="{x:Bind mtu:Converters.StringNotEmptyToVisibility(WorkspaceName), Mode=OneWay}" />
71-
</StackPanel>
72-
</Button.Content>
73-
<Button.Flyout>
74-
<MenuFlyout x:Name="WorkspaceFlyout" />
75-
</Button.Flyout>
76-
</Button>
77-
</StackPanel>
38+
<!-- EA18 is the "Shield" glyph -->
39+
<FontIcon x:Uid="ElevationShield"
40+
Margin="9,4,0,4"
41+
FontFamily="{ThemeResource SymbolThemeFontFamily}"
42+
FontSize="16"
43+
Foreground="{ThemeResource SystemControlForegroundBaseMediumBrush}"
44+
Glyph="&#xEA18;"
45+
Visibility="{x:Bind ShowElevationShield, Mode=OneWay}" />
7846
</mux:TabView.TabStripHeader>
7947

8048
<mux:TabView.TabStripFooter>

0 commit comments

Comments
 (0)