Skip to content

Commit 71f09b8

Browse files
committed
fix: ensure main command displays icon in context menu (#88)
Assign the icon to the underlying `SearchWebCommand` and `OpenHomePageCommand` to prevent them from appearing without an icon when the "More Commands" context menu is opened via right-click.
1 parent 8d99289 commit 71f09b8

2 files changed

Lines changed: 6 additions & 2 deletions

File tree

CmdPalWebSearchShortcut/WebSearchShortcut/Pages/FallbackSearchWebItem.cs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,7 @@ public FallbackSearchWebItem(WebSearchShortcutDataEntry shortcut)
2424

2525
_searchWebCommand = (SearchWebCommand) Command!;
2626
_searchWebCommand.Name = string.Empty;
27+
_searchWebCommand.Icon = Icons.Search;
2728

2829
Title = string.Empty;
2930
Subtitle = string.Empty;

CmdPalWebSearchShortcut/WebSearchShortcut/Pages/SearchWebPage.cs

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,8 @@ public SearchWebPage(WebSearchShortcutDataEntry shortcut)
3838

3939
var openHomepagecommand = new OpenHomePageCommand(shortcut)
4040
{
41-
Name = StringFormatter.Format(Resources.OpenHomepageItem_NameTemplate, new() { ["shortcut"] = shortcut.Name })
41+
Name = StringFormatter.Format(Resources.OpenHomepageItem_NameTemplate, new() { ["shortcut"] = shortcut.Name }),
42+
Icon = Icons.Home
4243
};
4344
_openHomepageListItem = new ListItem(openHomepagecommand)
4445
{
@@ -171,6 +172,7 @@ private ListItem[] BuildPrimaryItems(string searchText)
171172
new SearchWebCommand(_shortcut, searchText)
172173
{
173174
Name = StringFormatter.Format(Resources.SearchQueryItem_NameTemplate, new() { ["shortcut"] = _shortcut.Name, ["query"] = searchText }),
175+
Icon = Icons.Search
174176
}
175177
)
176178
{
@@ -195,7 +197,8 @@ private async Task<ListItem[]> FetchSuggestionItemsAsync(string searchText, Canc
195197
.. suggestions.Select(suggestion => new ListItem(
196198
new SearchWebCommand(_shortcut, suggestion.Title)
197199
{
198-
Name = StringFormatter.Format(Resources.SearchQueryItem_NameTemplate, new() { ["shortcut"] = _shortcut.Name, ["query"] = suggestion.Title })
200+
Name = StringFormatter.Format(Resources.SearchQueryItem_NameTemplate, new() { ["shortcut"] = _shortcut.Name, ["query"] = suggestion.Title }),
201+
Icon = Icons.Search
199202
}
200203
)
201204
{

0 commit comments

Comments
 (0)