mirror of
https://github.com/microsoft/PowerToys.git
synced 2026-04-06 03:07:04 +02:00
Standardizing built-in extension icon handling (#40606)
Just standardizing built-in extensions to use a `internal sealed class Icons` for all their non-dynamic icons. Looks like a LOT of changes, but it's icons all the way down.
This commit is contained in:
@@ -26,17 +26,17 @@ internal sealed partial class ExecuteItem : InvokableCommand
|
||||
if (type == RunAsType.Administrator)
|
||||
{
|
||||
Name = Properties.Resources.cmd_run_as_administrator;
|
||||
Icon = new IconInfo("\xE7EF"); // Admin Icon
|
||||
Icon = Icons.AdminIcon;
|
||||
}
|
||||
else if (type == RunAsType.OtherUser)
|
||||
{
|
||||
Name = Properties.Resources.cmd_run_as_user;
|
||||
Icon = new IconInfo("\xE7EE"); // User Icon
|
||||
Icon = Icons.UserIcon;
|
||||
}
|
||||
else
|
||||
{
|
||||
Name = Properties.Resources.generic_run_command;
|
||||
Icon = new IconInfo("\uE751"); // Return Key Icon
|
||||
Icon = Icons.ReturnIcon;
|
||||
}
|
||||
|
||||
Cmd = cmd;
|
||||
|
||||
@@ -24,7 +24,7 @@ internal sealed partial class FallbackExecuteItem : FallbackCommandItem
|
||||
Title = string.Empty;
|
||||
_executeItem.Name = string.Empty;
|
||||
Subtitle = Properties.Resources.generic_run_command;
|
||||
Icon = Icons.RunV2; // Defined in Icons.cs and contains the execute command icon.
|
||||
Icon = Icons.RunV2Icon; // Defined in Icons.cs and contains the execute command icon.
|
||||
}
|
||||
|
||||
public override void UpdateQuery(string query)
|
||||
|
||||
@@ -55,7 +55,7 @@ public class ShellListPageHelpers
|
||||
|
||||
// Using CurrentCulture since this is user facing
|
||||
Subtitle = Properties.Resources.cmd_plugin_name + ": " + string.Format(CultureInfo.CurrentCulture, CmdHasBeenExecutedTimes, m.Value),
|
||||
Icon = new IconInfo("\uE81C"),
|
||||
Icon = Icons.HistoryIcon,
|
||||
};
|
||||
return ret;
|
||||
}).Where(o => o != null).Take(4);
|
||||
@@ -108,7 +108,7 @@ public class ShellListPageHelpers
|
||||
|
||||
// Using CurrentCulture since this is user facing
|
||||
Subtitle = Properties.Resources.cmd_plugin_name + ": " + string.Format(CultureInfo.CurrentCulture, CmdHasBeenExecutedTimes, m.Value),
|
||||
Icon = new IconInfo("\uE81C"),
|
||||
Icon = Icons.HistoryIcon,
|
||||
}).Take(5);
|
||||
|
||||
return history.ToList();
|
||||
|
||||
@@ -8,5 +8,13 @@ namespace Microsoft.CmdPal.Ext.Shell;
|
||||
|
||||
internal sealed class Icons
|
||||
{
|
||||
internal static IconInfo RunV2 { get; } = IconHelpers.FromRelativePath("Assets\\Run.svg");
|
||||
internal static IconInfo RunV2Icon { get; } = IconHelpers.FromRelativePath("Assets\\Run.svg");
|
||||
|
||||
internal static IconInfo HistoryIcon { get; } = new IconInfo("\uE81C"); // History
|
||||
|
||||
internal static IconInfo AdminIcon { get; } = new IconInfo("\xE7EF"); // Admin Icon
|
||||
|
||||
internal static IconInfo UserIcon { get; } = new IconInfo("\xE7EE"); // User Icon
|
||||
|
||||
internal static IconInfo ReturnIcon { get; } = new IconInfo("\uE751"); // Return Key Icon
|
||||
}
|
||||
|
||||
@@ -15,7 +15,7 @@ internal sealed partial class ShellListPage : DynamicListPage
|
||||
|
||||
public ShellListPage(SettingsManager settingsManager)
|
||||
{
|
||||
Icon = Icons.RunV2;
|
||||
Icon = Icons.RunV2Icon;
|
||||
Id = "com.microsoft.cmdpal.shell";
|
||||
Name = Resources.cmd_plugin_name;
|
||||
PlaceholderText = Resources.list_placeholder_text;
|
||||
|
||||
@@ -20,14 +20,14 @@ public partial class ShellCommandsProvider : CommandProvider
|
||||
{
|
||||
Id = "Run";
|
||||
DisplayName = Resources.cmd_plugin_name;
|
||||
Icon = Icons.RunV2;
|
||||
Icon = Icons.RunV2Icon;
|
||||
Settings = _settingsManager.Settings;
|
||||
|
||||
_fallbackItem = new FallbackExecuteItem(_settingsManager);
|
||||
|
||||
_shellPageItem = new CommandItem(new ShellListPage(_settingsManager))
|
||||
{
|
||||
Icon = Icons.RunV2,
|
||||
Icon = Icons.RunV2Icon,
|
||||
Title = Resources.shell_command_name,
|
||||
Subtitle = Resources.cmd_plugin_description,
|
||||
MoreCommands = [
|
||||
|
||||
Reference in New Issue
Block a user