Skip to content

Commit 119c14c

Browse files
authored
feat!: include OpenHomePageCommand in each shortcut’s CommandItem.MoreCommands (#62)
1 parent 888d8c8 commit 119c14c

1 file changed

Lines changed: 13 additions & 1 deletion

File tree

CmdPalWebSearchShortcut/WebSearchShortcut/WebSearchShortcutCommandsProvider.cs

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@
99
using System.Linq;
1010
using Microsoft.CommandPalette.Extensions;
1111
using Microsoft.CommandPalette.Extensions.Toolkit;
12+
using WebSearchShortcut.Commands;
1213
using WebSearchShortcut.Helpers;
1314
using WebSearchShortcut.Properties;
1415
using WebSearchShortcut.Services;
@@ -131,6 +132,17 @@ private void LoadShortcutFromFile()
131132

132133
private CommandItem CreateCommandItem(WebSearchShortcutDataEntry shortcut)
133134
{
135+
var openHomepageCommand = new CommandContextItem(
136+
new OpenHomePageCommand(shortcut)
137+
{
138+
Name = StringFormatter.Format(Resources.OpenHomepageItem_NameTemplate, new() { ["shortcut"] = shortcut.Name })
139+
}
140+
)
141+
{
142+
Title = StringFormatter.Format(Resources.OpenHomepageItem_TitleTemplate, new() { ["shortcut"] = shortcut.Name }),
143+
Icon = Icons.Home
144+
};
145+
134146
var editShortcutPage = new AddShortcutPage(shortcut)
135147
{
136148
Name = StringFormatter.Format(Resources.EditShortcutItem_NameTemplate, new() { ["shortcut"] = shortcut.Name }),
@@ -173,7 +185,7 @@ private CommandItem CreateCommandItem(WebSearchShortcutDataEntry shortcut)
173185
Title = StringFormatter.Format(Resources.ShortcutItem_TitleTemplate, new() { ["shortcut"] = shortcut.Name }),
174186
Subtitle = StringFormatter.Format(Resources.ShortcutItem_SubtitleTemplate, new() { ["shortcut"] = shortcut.Name }),
175187
Icon = IconService.GetIconInfo(shortcut),
176-
MoreCommands = [editCommand, deleteCommand]
188+
MoreCommands = [openHomepageCommand, editCommand, deleteCommand]
177189
};
178190

179191
return commandItem;

0 commit comments

Comments
 (0)