mirror of
https://github.com/microsoft/PowerToys.git
synced 2025-12-15 19:27:56 +01:00
use winui3 icons
This commit is contained in:
@@ -52,6 +52,8 @@ internal static class AwakeCommandsFactory
|
|||||||
Toast: "Awake timer set for 2 hours"),
|
Toast: "Awake timer set for 2 hours"),
|
||||||
];
|
];
|
||||||
|
|
||||||
|
private static readonly IconInfo AwakeIcon = PowerToysResourcesHelper.IconFromSettingsIcon("Awake.png");
|
||||||
|
|
||||||
internal static void PopulateModuleCommands(List<ICommandContextItem> moreCommands)
|
internal static void PopulateModuleCommands(List<ICommandContextItem> moreCommands)
|
||||||
{
|
{
|
||||||
ArgumentNullException.ThrowIfNull(moreCommands);
|
ArgumentNullException.ThrowIfNull(moreCommands);
|
||||||
@@ -76,7 +78,7 @@ internal static class AwakeCommandsFactory
|
|||||||
{
|
{
|
||||||
Title = "Current status",
|
Title = "Current status",
|
||||||
Subtitle = statusSubtitle,
|
Subtitle = statusSubtitle,
|
||||||
Icon = IconHelpers.FromRelativePath("Assets\\Awake.png"),
|
Icon = AwakeIcon,
|
||||||
};
|
};
|
||||||
|
|
||||||
results.Add(statusItem);
|
results.Add(statusItem);
|
||||||
@@ -94,7 +96,7 @@ internal static class AwakeCommandsFactory
|
|||||||
{
|
{
|
||||||
Title = preset.Title,
|
Title = preset.Title,
|
||||||
Subtitle = preset.Subtitle,
|
Subtitle = preset.Subtitle,
|
||||||
Icon = IconHelpers.FromRelativePath("Assets\\Awake.png"),
|
Icon = AwakeIcon,
|
||||||
};
|
};
|
||||||
results.Add(item);
|
results.Add(item);
|
||||||
}
|
}
|
||||||
@@ -119,7 +121,7 @@ internal static class AwakeCommandsFactory
|
|||||||
{
|
{
|
||||||
Title = title,
|
Title = title,
|
||||||
Subtitle = subtitle,
|
Subtitle = subtitle,
|
||||||
Icon = IconHelpers.FromRelativePath("Assets\\Awake.png"),
|
Icon = AwakeIcon,
|
||||||
};
|
};
|
||||||
results.Add(item);
|
results.Add(item);
|
||||||
}
|
}
|
||||||
@@ -130,7 +132,7 @@ internal static class AwakeCommandsFactory
|
|||||||
{
|
{
|
||||||
Title = "Bind Awake to another process",
|
Title = "Bind Awake to another process",
|
||||||
Subtitle = "Stop automatically when the target process exits",
|
Subtitle = "Stop automatically when the target process exits",
|
||||||
Icon = IconHelpers.FromRelativePath("Assets\\Awake.png"),
|
Icon = AwakeIcon,
|
||||||
};
|
};
|
||||||
|
|
||||||
results.Add(new ListItem(processPageItem)
|
results.Add(new ListItem(processPageItem)
|
||||||
@@ -148,7 +150,7 @@ internal static class AwakeCommandsFactory
|
|||||||
{
|
{
|
||||||
Title = "Set Awake to Off",
|
Title = "Set Awake to Off",
|
||||||
Subtitle = "Switch Awake to passive mode",
|
Subtitle = "Switch Awake to passive mode",
|
||||||
Icon = IconHelpers.FromRelativePath("Assets\\Awake.png"),
|
Icon = AwakeIcon,
|
||||||
};
|
};
|
||||||
results.Add(stopItem);
|
results.Add(stopItem);
|
||||||
}
|
}
|
||||||
@@ -160,7 +162,7 @@ internal static class AwakeCommandsFactory
|
|||||||
{
|
{
|
||||||
Title = "Open Awake settings",
|
Title = "Open Awake settings",
|
||||||
Subtitle = "Configure Awake inside PowerToys",
|
Subtitle = "Configure Awake inside PowerToys",
|
||||||
Icon = IconHelpers.FromRelativePath("Assets\\Awake.png"),
|
Icon = AwakeIcon,
|
||||||
};
|
};
|
||||||
results.Add(settingsItem);
|
results.Add(settingsItem);
|
||||||
}
|
}
|
||||||
@@ -207,7 +209,7 @@ internal static class AwakeCommandsFactory
|
|||||||
{
|
{
|
||||||
Title = title,
|
Title = title,
|
||||||
Subtitle = "Keep the PC awake while this process is running",
|
Subtitle = "Keep the PC awake while this process is running",
|
||||||
Icon = IconHelpers.FromRelativePath("Assets\\Awake.png"),
|
Icon = AwakeIcon,
|
||||||
};
|
};
|
||||||
results.Add(item);
|
results.Add(item);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -9,48 +9,52 @@ namespace PowerToysExtension.Helpers;
|
|||||||
|
|
||||||
internal static class PowerToysResourcesHelper
|
internal static class PowerToysResourcesHelper
|
||||||
{
|
{
|
||||||
public static IconInfo ProviderIcon() => IconHelpers.FromRelativePath("Assets\\PowerToys.png");
|
private const string SettingsIconRoot = "WinUI3Apps\\Assets\\Settings\\Icons\\";
|
||||||
|
|
||||||
|
internal static IconInfo IconFromSettingsIcon(string fileName) => IconHelpers.FromRelativePath($"{SettingsIconRoot}{fileName}");
|
||||||
|
|
||||||
|
public static IconInfo ProviderIcon() => IconFromSettingsIcon("PowerToys.png");
|
||||||
|
|
||||||
public static IconInfo ModuleIcon(this SettingsWindow module)
|
public static IconInfo ModuleIcon(this SettingsWindow module)
|
||||||
{
|
{
|
||||||
var iconPath = module switch
|
var iconFile = module switch
|
||||||
{
|
{
|
||||||
SettingsWindow.ColorPicker => "Assets\\ColorPicker.png",
|
SettingsWindow.ColorPicker => "ColorPicker.png",
|
||||||
SettingsWindow.FancyZones => "Assets\\FancyZones.png",
|
SettingsWindow.FancyZones => "FancyZones.png",
|
||||||
SettingsWindow.Hosts => "Assets\\Hosts.png",
|
SettingsWindow.Hosts => "Hosts.png",
|
||||||
SettingsWindow.PowerOCR => "Assets\\TextExtractor.png",
|
SettingsWindow.PowerOCR => "TextExtractor.png",
|
||||||
SettingsWindow.RegistryPreview => "Assets\\RegistryPreview.png",
|
SettingsWindow.RegistryPreview => "RegistryPreview.png",
|
||||||
SettingsWindow.MeasureTool => "Assets\\ScreenRuler.png",
|
SettingsWindow.MeasureTool => "ScreenRuler.png",
|
||||||
SettingsWindow.ShortcutGuide => "Assets\\ShortcutGuide.png",
|
SettingsWindow.ShortcutGuide => "ShortcutGuide.png",
|
||||||
SettingsWindow.CropAndLock => "Assets\\CropAndLock.png",
|
SettingsWindow.CropAndLock => "CropAndLock.png",
|
||||||
SettingsWindow.EnvironmentVariables => "Assets\\EnvironmentVariables.png",
|
SettingsWindow.EnvironmentVariables => "EnvironmentVariables.png",
|
||||||
SettingsWindow.Awake => "Assets\\Awake.png",
|
SettingsWindow.Awake => "Awake.png",
|
||||||
SettingsWindow.PowerRename => "Assets\\PowerRename.png",
|
SettingsWindow.PowerRename => "PowerRename.png",
|
||||||
SettingsWindow.Run => "Assets\\PowerToysRun.png",
|
SettingsWindow.Run => "PowerToysRun.png",
|
||||||
SettingsWindow.ImageResizer => "Assets\\ImageResizer.png",
|
SettingsWindow.ImageResizer => "ImageResizer.png",
|
||||||
SettingsWindow.KBM => "Assets\\KeyboardManager.png",
|
SettingsWindow.KBM => "KeyboardManager.png",
|
||||||
SettingsWindow.MouseUtils => "Assets\\MouseUtils.png",
|
SettingsWindow.MouseUtils => "MouseUtils.png",
|
||||||
SettingsWindow.Workspaces => "Assets\\Workspaces.png",
|
SettingsWindow.Workspaces => "Workspaces.png",
|
||||||
SettingsWindow.AdvancedPaste => "Assets\\AdvancedPaste.png",
|
SettingsWindow.AdvancedPaste => "AdvancedPaste.png",
|
||||||
SettingsWindow.CmdPal => "Assets\\CmdPal.png",
|
SettingsWindow.CmdPal => "CmdPal.png",
|
||||||
SettingsWindow.ZoomIt => "Assets\\ZoomIt.png",
|
SettingsWindow.ZoomIt => "ZoomIt.png",
|
||||||
SettingsWindow.FileExplorer => "Assets\\FileExplorerPreview.png",
|
SettingsWindow.FileExplorer => "FileExplorerPreview.png",
|
||||||
SettingsWindow.FileLocksmith => "Assets\\FileLocksmith.png",
|
SettingsWindow.FileLocksmith => "FileLocksmith.png",
|
||||||
SettingsWindow.NewPlus => "Assets\\NewPlus.png",
|
SettingsWindow.NewPlus => "NewPlus.png",
|
||||||
SettingsWindow.Peek => "Assets\\Peek.png",
|
SettingsWindow.Peek => "Peek.png",
|
||||||
SettingsWindow.LightSwitch => "Assets\\LightSwitch.png",
|
SettingsWindow.LightSwitch => "LightSwitch.png",
|
||||||
SettingsWindow.AlwaysOnTop => "Assets\\AlwaysOnTop.png",
|
SettingsWindow.AlwaysOnTop => "AlwaysOnTop.png",
|
||||||
SettingsWindow.CmdNotFound => "Assets\\CommandNotFound.png",
|
SettingsWindow.CmdNotFound => "CommandNotFound.png",
|
||||||
SettingsWindow.MouseWithoutBorders => "Assets\\MouseWithoutBorders.png",
|
SettingsWindow.MouseWithoutBorders => "MouseWithoutBorders.png",
|
||||||
SettingsWindow.PowerAccent => "Assets\\QuickAccent.png",
|
SettingsWindow.PowerAccent => "QuickAccent.png",
|
||||||
SettingsWindow.PowerLauncher => "Assets\\PowerToysRun.png",
|
SettingsWindow.PowerLauncher => "PowerToysRun.png",
|
||||||
SettingsWindow.PowerPreview => "Assets\\FileExplorerPreview.png",
|
SettingsWindow.PowerPreview => "FileExplorerPreview.png",
|
||||||
SettingsWindow.Overview => "Assets\\PowerToys.png",
|
SettingsWindow.Overview => "PowerToys.png",
|
||||||
SettingsWindow.Dashboard => "Assets\\PowerToys.png",
|
SettingsWindow.Dashboard => "PowerToys.png",
|
||||||
_ => "Assets\\PowerToys.png",
|
_ => "PowerToys.png",
|
||||||
};
|
};
|
||||||
|
|
||||||
return IconHelpers.FromRelativePath(iconPath);
|
return IconFromSettingsIcon(iconFile);
|
||||||
}
|
}
|
||||||
|
|
||||||
public static string ModuleDisplayName(this SettingsWindow module)
|
public static string ModuleDisplayName(this SettingsWindow module)
|
||||||
|
|||||||
@@ -17,7 +17,7 @@ internal sealed class AwakeModuleCommandProvider : ModuleCommandProvider
|
|||||||
public override IEnumerable<ListItem> BuildCommands()
|
public override IEnumerable<ListItem> BuildCommands()
|
||||||
{
|
{
|
||||||
var items = new List<ListItem>();
|
var items = new List<ListItem>();
|
||||||
var icon = IconHelpers.FromRelativePath("Assets\\Awake.png");
|
var icon = PowerToysResourcesHelper.IconFromSettingsIcon("Awake.png");
|
||||||
|
|
||||||
// Settings entry with quick actions in MoreCommands.
|
// Settings entry with quick actions in MoreCommands.
|
||||||
var settingsTitle = SettingsDeepLink.SettingsWindow.Awake.ModuleDisplayName();
|
var settingsTitle = SettingsDeepLink.SettingsWindow.Awake.ModuleDisplayName();
|
||||||
|
|||||||
@@ -21,6 +21,7 @@ internal sealed class WorkspacesModuleCommandProvider : ModuleCommandProvider
|
|||||||
public override IEnumerable<ListItem> BuildCommands()
|
public override IEnumerable<ListItem> BuildCommands()
|
||||||
{
|
{
|
||||||
var items = new List<ListItem>();
|
var items = new List<ListItem>();
|
||||||
|
var icon = PowerToysResourcesHelper.IconFromSettingsIcon("Workspaces.png");
|
||||||
|
|
||||||
// Settings entry plus common actions.
|
// Settings entry plus common actions.
|
||||||
var title = SettingsDeepLink.SettingsWindow.Workspaces.ModuleDisplayName();
|
var title = SettingsDeepLink.SettingsWindow.Workspaces.ModuleDisplayName();
|
||||||
@@ -40,7 +41,7 @@ internal sealed class WorkspacesModuleCommandProvider : ModuleCommandProvider
|
|||||||
{
|
{
|
||||||
Title = "Workspaces: Open editor",
|
Title = "Workspaces: Open editor",
|
||||||
Subtitle = "Create or edit workspaces",
|
Subtitle = "Create or edit workspaces",
|
||||||
Icon = IconHelpers.FromRelativePath("Assets\\Workspaces.png"),
|
Icon = icon,
|
||||||
});
|
});
|
||||||
|
|
||||||
// Per-workspace entries via the shared service.
|
// Per-workspace entries via the shared service.
|
||||||
@@ -55,7 +56,7 @@ internal sealed class WorkspacesModuleCommandProvider : ModuleCommandProvider
|
|||||||
{
|
{
|
||||||
Title = workspace.Name,
|
Title = workspace.Name,
|
||||||
Subtitle = BuildSubtitle(workspace),
|
Subtitle = BuildSubtitle(workspace),
|
||||||
Icon = IconHelpers.FromRelativePath("Assets\\Workspaces.png"),
|
Icon = icon,
|
||||||
Details = BuildDetails(workspace),
|
Details = BuildDetails(workspace),
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
@@ -104,7 +105,7 @@ internal sealed class WorkspacesModuleCommandProvider : ModuleCommandProvider
|
|||||||
|
|
||||||
return new Details
|
return new Details
|
||||||
{
|
{
|
||||||
HeroImage = IconHelpers.FromRelativePath("Assets\\Workspaces.png"),
|
HeroImage = PowerToysResourcesHelper.IconFromSettingsIcon("Workspaces.png"),
|
||||||
Title = workspace.Name,
|
Title = workspace.Name,
|
||||||
Metadata = BuildAppMetadata(workspace),
|
Metadata = BuildAppMetadata(workspace),
|
||||||
};
|
};
|
||||||
|
|||||||
@@ -14,7 +14,7 @@ internal sealed partial class AwakeProcessListPage : DynamicListPage
|
|||||||
|
|
||||||
public AwakeProcessListPage()
|
public AwakeProcessListPage()
|
||||||
{
|
{
|
||||||
Icon = IconHelpers.FromRelativePath("Assets\\Awake.png");
|
Icon = PowerToysResourcesHelper.IconFromSettingsIcon("Awake.png");
|
||||||
Title = "Bind Awake to process";
|
Title = "Bind Awake to process";
|
||||||
Name = "AwakeProcessBinding";
|
Name = "AwakeProcessBinding";
|
||||||
Id = "com.microsoft.powertoys.awake.processBinding";
|
Id = "com.microsoft.powertoys.awake.processBinding";
|
||||||
@@ -23,7 +23,7 @@ internal sealed partial class AwakeProcessListPage : DynamicListPage
|
|||||||
{
|
{
|
||||||
Title = "No matching processes",
|
Title = "No matching processes",
|
||||||
Subtitle = "Try another search.",
|
Subtitle = "Try another search.",
|
||||||
Icon = IconHelpers.FromRelativePath("Assets\\Awake.png"),
|
Icon = PowerToysResourcesHelper.IconFromSettingsIcon("Awake.png"),
|
||||||
};
|
};
|
||||||
|
|
||||||
EmptyContent = _emptyContent;
|
EmptyContent = _emptyContent;
|
||||||
|
|||||||
@@ -14,7 +14,7 @@ internal sealed partial class AwakeSessionsPage : DynamicListPage
|
|||||||
|
|
||||||
public AwakeSessionsPage()
|
public AwakeSessionsPage()
|
||||||
{
|
{
|
||||||
Icon = IconHelpers.FromRelativePath("Assets\\Awake.png");
|
Icon = PowerToysResourcesHelper.IconFromSettingsIcon("Awake.png");
|
||||||
Title = "Awake actions";
|
Title = "Awake actions";
|
||||||
Name = "AwakeActions";
|
Name = "AwakeActions";
|
||||||
Id = "com.microsoft.powertoys.awake.actions";
|
Id = "com.microsoft.powertoys.awake.actions";
|
||||||
@@ -23,7 +23,7 @@ internal sealed partial class AwakeSessionsPage : DynamicListPage
|
|||||||
{
|
{
|
||||||
Title = "No Awake actions",
|
Title = "No Awake actions",
|
||||||
Subtitle = "Try a different search phrase.",
|
Subtitle = "Try a different search phrase.",
|
||||||
Icon = IconHelpers.FromRelativePath("Assets\\Awake.png"),
|
Icon = PowerToysResourcesHelper.IconFromSettingsIcon("Awake.png"),
|
||||||
};
|
};
|
||||||
|
|
||||||
EmptyContent = _emptyContent;
|
EmptyContent = _emptyContent;
|
||||||
|
|||||||
@@ -19,7 +19,7 @@ internal sealed partial class ColorPickerSavedColorsPage : DynamicListPage
|
|||||||
|
|
||||||
public ColorPickerSavedColorsPage()
|
public ColorPickerSavedColorsPage()
|
||||||
{
|
{
|
||||||
Icon = IconHelpers.FromRelativePath("Assets\\ColorPicker.png");
|
Icon = PowerToysResourcesHelper.IconFromSettingsIcon("ColorPicker.png");
|
||||||
Title = "Saved colors";
|
Title = "Saved colors";
|
||||||
Name = "ColorPickerSavedColors";
|
Name = "ColorPickerSavedColors";
|
||||||
Id = "com.microsoft.powertoys.colorpicker.savedColors";
|
Id = "com.microsoft.powertoys.colorpicker.savedColors";
|
||||||
@@ -28,7 +28,7 @@ internal sealed partial class ColorPickerSavedColorsPage : DynamicListPage
|
|||||||
{
|
{
|
||||||
Title = "No saved colors",
|
Title = "No saved colors",
|
||||||
Subtitle = "Pick a color first, then try again.",
|
Subtitle = "Pick a color first, then try again.",
|
||||||
Icon = IconHelpers.FromRelativePath("Assets\\ColorPicker.png"),
|
Icon = PowerToysResourcesHelper.IconFromSettingsIcon("ColorPicker.png"),
|
||||||
};
|
};
|
||||||
|
|
||||||
EmptyContent = _emptyContent;
|
EmptyContent = _emptyContent;
|
||||||
|
|||||||
@@ -13,7 +13,7 @@ internal sealed partial class PowerToysExtensionPage : ListPage
|
|||||||
{
|
{
|
||||||
public PowerToysExtensionPage()
|
public PowerToysExtensionPage()
|
||||||
{
|
{
|
||||||
Icon = IconHelpers.FromRelativePath("Assets\\PowerToys.png");
|
Icon = Helpers.PowerToysResourcesHelper.IconFromSettingsIcon("PowerToys.png");
|
||||||
Title = "PowerToys";
|
Title = "PowerToys";
|
||||||
Name = "PowerToys commands";
|
Name = "PowerToys commands";
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -14,12 +14,12 @@ internal sealed partial class PowerToysListPage : DynamicListPage
|
|||||||
|
|
||||||
public PowerToysListPage()
|
public PowerToysListPage()
|
||||||
{
|
{
|
||||||
Icon = IconHelpers.FromRelativePath("Assets\\PowerToys.png");
|
Icon = PowerToysResourcesHelper.IconFromSettingsIcon("PowerToys.png");
|
||||||
Name = Title = "PowerToys";
|
Name = Title = "PowerToys";
|
||||||
Id = "com.microsoft.cmdpal.powertoys";
|
Id = "com.microsoft.cmdpal.powertoys";
|
||||||
_empty = new CommandItem()
|
_empty = new CommandItem()
|
||||||
{
|
{
|
||||||
Icon = IconHelpers.FromRelativePath("Assets\\PowerToys.png"),
|
Icon = PowerToysResourcesHelper.IconFromSettingsIcon("PowerToys.png"),
|
||||||
Title = "No matching module found",
|
Title = "No matching module found",
|
||||||
Subtitle = SearchText,
|
Subtitle = SearchText,
|
||||||
};
|
};
|
||||||
|
|||||||
@@ -5,6 +5,7 @@
|
|||||||
using System.Linq;
|
using System.Linq;
|
||||||
using Microsoft.CommandPalette.Extensions;
|
using Microsoft.CommandPalette.Extensions;
|
||||||
using Microsoft.CommandPalette.Extensions.Toolkit;
|
using Microsoft.CommandPalette.Extensions.Toolkit;
|
||||||
|
using PowerToysExtension.Helpers;
|
||||||
using PowerToysExtension.Modules;
|
using PowerToysExtension.Modules;
|
||||||
|
|
||||||
namespace PowerToysExtension.Pages;
|
namespace PowerToysExtension.Pages;
|
||||||
@@ -15,12 +16,12 @@ internal sealed partial class WorkspacesListPage : DynamicListPage
|
|||||||
|
|
||||||
public WorkspacesListPage()
|
public WorkspacesListPage()
|
||||||
{
|
{
|
||||||
Icon = IconHelpers.FromRelativePath("Assets\\Workspaces.png");
|
Icon = PowerToysResourcesHelper.IconFromSettingsIcon("Workspaces.png");
|
||||||
Name = Title = "Workspaces";
|
Name = Title = "Workspaces";
|
||||||
Id = "com.microsoft.cmdpal.powertoys.workspaces";
|
Id = "com.microsoft.cmdpal.powertoys.workspaces";
|
||||||
_emptyMessage = new CommandItem()
|
_emptyMessage = new CommandItem()
|
||||||
{
|
{
|
||||||
Icon = IconHelpers.FromRelativePath("Assets\\Workspaces.png"),
|
Icon = PowerToysResourcesHelper.IconFromSettingsIcon("Workspaces.png"),
|
||||||
Title = "No workspaces found",
|
Title = "No workspaces found",
|
||||||
Subtitle = SearchText,
|
Subtitle = SearchText,
|
||||||
};
|
};
|
||||||
|
|||||||
@@ -15,7 +15,7 @@ public sealed partial class PowerToysCommandsProvider : CommandProvider
|
|||||||
public PowerToysCommandsProvider()
|
public PowerToysCommandsProvider()
|
||||||
{
|
{
|
||||||
DisplayName = "PowerToys";
|
DisplayName = "PowerToys";
|
||||||
Icon = IconHelpers.FromRelativePath("Assets\\PowerToys.png");
|
Icon = PowerToysResourcesHelper.IconFromSettingsIcon("PowerToys.png");
|
||||||
}
|
}
|
||||||
|
|
||||||
public override ICommandItem[] TopLevelCommands() =>
|
public override ICommandItem[] TopLevelCommands() =>
|
||||||
|
|||||||
@@ -16,7 +16,7 @@ public partial class PowerToysExtensionCommandsProvider : CommandProvider
|
|||||||
public PowerToysExtensionCommandsProvider()
|
public PowerToysExtensionCommandsProvider()
|
||||||
{
|
{
|
||||||
DisplayName = "PowerToys";
|
DisplayName = "PowerToys";
|
||||||
Icon = IconHelpers.FromRelativePath("Assets\\PowerToys.png");
|
Icon = PowerToysResourcesHelper.IconFromSettingsIcon("PowerToys.png");
|
||||||
_commands = [
|
_commands = [
|
||||||
new CommandItem(new Pages.PowerToysListPage())
|
new CommandItem(new Pages.PowerToysListPage())
|
||||||
{
|
{
|
||||||
|
|||||||
Reference in New Issue
Block a user