Skip to content

Commit 842326d

Browse files
committed
icons for non-terminal pane content
1 parent fb7c809 commit 842326d

9 files changed

+31
-11
lines changed

src/cascadia/TerminalApp/IPaneContent.idl

+1
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@ namespace TerminalApp
1919
UInt64 TaskbarState { get; };
2020
UInt64 TaskbarProgress { get; };
2121
Boolean ReadOnly { get; };
22+
String Icon { get; };
2223

2324
Microsoft.Terminal.Settings.Model.NewTerminalArgs GetNewTerminalArgs(Boolean asContent);
2425

src/cascadia/TerminalApp/ScratchpadContent.cpp

+6
Original file line numberDiff line numberDiff line change
@@ -50,4 +50,10 @@ namespace winrt::TerminalApp::implementation
5050
{
5151
return nullptr;
5252
}
53+
54+
winrt::hstring ScratchpadContent::Icon() const
55+
{
56+
static constexpr std::wstring_view glyph{ L"\xe70b" }; // QuickNote
57+
return winrt::hstring{ glyph };
58+
}
5359
}

src/cascadia/TerminalApp/ScratchpadContent.h

+1
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,7 @@ namespace winrt::TerminalApp::implementation
2121
uint64_t TaskbarState() { return 0; }
2222
uint64_t TaskbarProgress() { return 0; }
2323
bool ReadOnly() { return false; }
24+
winrt::hstring Icon() const;
2425

2526
til::typed_event<> CloseRequested;
2627
til::typed_event<winrt::Windows::Foundation::IInspectable, winrt::TerminalApp::BellEventArgs> BellRequested;

src/cascadia/TerminalApp/SettingsPaneContent.cpp

+7
Original file line numberDiff line numberDiff line change
@@ -42,4 +42,11 @@ namespace winrt::TerminalApp::implementation
4242
// TODO! hey, can we somehow replicate std::vector<ActionAndArgs> SettingsTab::BuildStartupActions?
4343
return nullptr;
4444
}
45+
46+
winrt::hstring SettingsPaneContent::Icon() const
47+
{
48+
// This is the Setting icon (looks like a gear)
49+
static constexpr std::wstring_view glyph{ L"\xE713" };
50+
return winrt::hstring{ glyph };
51+
}
4552
}

src/cascadia/TerminalApp/SettingsPaneContent.h

+1
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,7 @@ namespace winrt::TerminalApp::implementation
2323
uint64_t TaskbarState() { return 0; }
2424
uint64_t TaskbarProgress() { return 0; }
2525
bool ReadOnly() { return false; }
26+
winrt::hstring Icon() const;
2627

2728
til::typed_event<> CloseRequested;
2829
til::typed_event<winrt::Windows::Foundation::IInspectable, winrt::TerminalApp::BellEventArgs> BellRequested;

src/cascadia/TerminalApp/TabManagement.cpp

+4-10
Original file line numberDiff line numberDiff line change
@@ -226,14 +226,8 @@ namespace winrt::TerminalApp::implementation
226226
auto tabViewItem = newTabImpl->TabViewItem();
227227
_tabView.TabItems().InsertAt(insertPosition, tabViewItem);
228228

229-
// Set this tab's icon to the icon from the user's profile
230-
if (const auto profile{ newTabImpl->GetFocusedProfile() })
231-
{
232-
if (!profile.Icon().empty())
233-
{
234-
newTabImpl->UpdateIcon(profile.Icon());
235-
}
236-
}
229+
// Set this tab's icon to the icon from the content
230+
_UpdateTabIcon(*newTabImpl);
237231

238232
tabViewItem.PointerReleased({ this, &TerminalPage::_OnTabClick });
239233

@@ -293,9 +287,9 @@ namespace winrt::TerminalApp::implementation
293287
// - tab: the Tab to update the title for.
294288
void TerminalPage::_UpdateTabIcon(TerminalTab& tab)
295289
{
296-
if (const auto profile = tab.GetFocusedProfile())
290+
if (const auto content{ tab.GetActiveContent() })
297291
{
298-
tab.UpdateIcon(profile.Icon());
292+
tab.UpdateIcon(content.Icon());
299293
}
300294
}
301295

src/cascadia/TerminalApp/TerminalPage.cpp

+5-1
Original file line numberDiff line numberDiff line change
@@ -2265,7 +2265,11 @@ namespace winrt::TerminalApp::implementation
22652265
const float splitSize,
22662266
std::shared_ptr<Pane> newPane)
22672267
{
2268-
// TODO! Prevent splitting the _settingsTab!
2268+
// For now, prevent splitting the _settingsTab. We can always revisit this later.
2269+
if (tab == _settingsTab)
2270+
{
2271+
return;
2272+
}
22692273

22702274
// If the caller is calling us with the return value of _MakePane
22712275
// directly, it's possible that nullptr was returned, if the connections

src/cascadia/TerminalApp/TerminalPaneContent.cpp

+5
Original file line numberDiff line numberDiff line change
@@ -76,6 +76,11 @@ namespace winrt::TerminalApp::implementation
7676
CloseRequested.raise(*this, nullptr);
7777
}
7878

79+
winrt::hstring TerminalPaneContent::Icon() const
80+
{
81+
return _profile.Icon();
82+
}
83+
7984
NewTerminalArgs TerminalPaneContent::GetNewTerminalArgs(const bool asContent) const
8085
{
8186
NewTerminalArgs args{};

src/cascadia/TerminalApp/TerminalPaneContent.h

+1
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,7 @@ namespace winrt::TerminalApp::implementation
3535
uint64_t TaskbarState() { return _control.TaskbarState(); }
3636
uint64_t TaskbarProgress() { return _control.TaskbarProgress(); }
3737
bool ReadOnly() { return _control.ReadOnly(); }
38+
winrt::hstring Icon() const;
3839

3940
float SnapDownToGrid(const TerminalApp::PaneSnapDirection direction, const float sizeToSnap);
4041
Windows::Foundation::Size GridSize();

0 commit comments

Comments
 (0)