shake off unnecessary

This commit is contained in:
kaitao-ms
2025-11-28 15:37:24 +08:00
parent e4f8ab1193
commit 883b9d6adc
31 changed files with 0 additions and 1993 deletions

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.7 KiB

View File

@@ -1,53 +0,0 @@
<?xml version="1.0" encoding="utf-8"?>
<svg version="1.2" baseProfile="tiny-ps" xmlns="http://www.w3.org/2000/svg" width="36px" height="36px" viewBox="0 0 36 36" preserveAspectRatio="xMidYMid meet">
<g fill="#000000">
<path d="M0 18 l0 -18 18 0 18 0 0 18 0 18 -18 0 -18 0 0 -18z m31 0 l0 -13 -13 0 -13 0 0 13 0 13 13 0 13 0 0 -13z"/>
</g>
<g fill="#4e5056">
<path d="M2 18 l0 -16 16 0 16 0 0 16 0 16 -16 0 -16 0 0 -16z m23 -4 l0 -4 -7.4 0 c-7.7 0 -8.6 0.5 -8.6 5 0 2.4 1.3 2.8 9.3 2.9 l6.7 0.1 0 -4z"/>
</g>
<g fill="#686564">
<path d="M3 18 l0 -15 4 0 c2.2 0 4 0.5 4 1 0 0.6 -1.3 1 -3 1 l-3 0 0 13 0 13 13 0 13 0 0 -13 0 -13 -5.5 0 c-3 0 -5.5 -0.4 -5.5 -1 0 -0.6 2.8 -1 6.5 -1 l6.5 0 0 15 0 15 -15 0 -15 0 0 -15z"/>
<path d="M6.2 17.7 c-0.1 -10.3 0.1 -11.8 1.4 -11.3 0.9 0.3 2 0.6 2.5 0.6 0.5 0 0.9 2.7 0.9 6 l0 6.1 7.3 -0.3 7.2 -0.3 0 -4 c0 -3.6 -0.3 -4 -2.7 -4.3 -6 -0.7 -2.2 -4.2 4.5 -4.2 l2.8 0 -0.2 11.8 -0.3 11.7 -11.6 0 -11.7 0 -0.1 -11.8z m8.8 8.8 c0 -0.8 -0.4 -1.5 -1 -1.5 -0.5 0 -1 0.7 -1 1.5 0 0.8 0.5 1.5 1 1.5 0.6 0 1 -0.7 1 -1.5z m8 0 c0 -0.8 -0.4 -1.5 -1 -1.5 -0.5 0 -1 0.7 -1 1.5 0 0.8 0.5 1.5 1 1.5 0.6 0 1 -0.7 1 -1.5z m5.6 -11.5 l0 -6.5 -0.3 6.3 -0.4 6.3 -10.4 -0.3 c-5.7 -0.2 -10.1 0.1 -9.8 0.5 0.2 0.4 5 0.6 10.6 0.5 l10.2 -0.3 0.1 -6.5z"/>
</g>
<g fill="#dd5215">
<path d="M8 14 l0 -7 4 0 4 0 0 7 0 7 -4 0 -4 0 0 -7z"/>
<path d="M7.8 4.3 c1.8 -0.2 4.5 -0.2 6 0 1.5 0.2 0 0.4 -3.3 0.4 -3.3 0 -4.5 -0.2 -2.7 -0.4z"/>
</g>
<g fill="#5ac228">
<path d="M15 17.2 c0 -3 0.5 -4.1 2.3 -5 l2.2 -1.1 -2.2 0 c-1.6 -0.1 -2.3 -0.7 -2.3 -2.1 0 -1.8 0.7 -2 5.5 -2 l5.5 0 0 7 0 7 -5.5 0 -5.5 0 0 -3.8z"/>
<path d="M17.8 4.3 c1.8 -0.2 4.5 -0.2 6 0 1.5 0.2 0 0.4 -3.3 0.4 -3.3 0 -4.5 -0.2 -2.7 -0.4z"/>
</g>
<g fill="#2681b5">
<path d="M23 18.6 c0 -3.7 1 -5.6 3.1 -5.6 1.5 0 1.9 0.7 1.9 4 0 3.6 -0.2 4 -2.5 4 -2 0 -2.5 -0.5 -2.5 -2.4z"/>
<path d="M20 9.6 c0 -0.7 1 -1.6 2.3 -2 4.1 -1.1 5.7 -0.7 5.7 1.4 0 1.7 -0.7 2 -4 2 -2.7 0 -4 -0.4 -4 -1.4z"/>
<path d="M22.8 4.3 c1.8 -0.2 4.5 -0.2 6 0 1.5 0.2 0 0.4 -3.3 0.4 -3.3 0 -4.5 -0.2 -2.7 -0.4z"/>
</g>
<g fill="#61d951">
<path d="M15 12.9 c0 -5.9 0.1 -6.1 2.3 -5.5 1.2 0.3 3.7 0.6 5.5 0.6 l3.3 0 -0.3 4.7 c-0.3 4.5 -2.8 7.6 -2.8 3.4 0 -1.8 -0.3 -1.9 -2.5 -0.9 -1.4 0.6 -2.5 1.7 -2.5 2.5 0 0.7 -0.7 1.3 -1.5 1.3 -1.2 0 -1.5 -1.3 -1.5 -6.1z"/>
</g>
<g fill="#1497e3">
<path d="M23 14.1 c0 -5 0.3 -5.9 1.9 -6.4 2.6 -0.6 3.1 0 3.1 3.9 0 4.4 -0.9 6.4 -2.9 6.5 -1.2 0 -1.2 0.2 0.4 0.9 1.9 0.8 1.9 0.9 -0.2 0.9 -2.1 0.1 -2.3 -0.3 -2.3 -5.8z"/>
<path d="M24.8 4.3 c1.2 -0.2 3 -0.2 4 0 0.9 0.3 -0.1 0.5 -2.3 0.4 -2.2 0 -3 -0.2 -1.7 -0.4z"/>
</g>
<g fill="#cdb416">
<path d="M13 19 c0 -1.5 0.7 -2 2.5 -2 1.8 0 2.5 0.5 2.5 2 0 1.5 -0.7 2 -2.5 2 -1.8 0 -2.5 -0.5 -2.5 -2z"/>
<path d="M13 9 c0 -1.5 0.7 -2 2.5 -2 1.8 0 2.5 0.5 2.5 2 0 1.5 -0.7 2 -2.5 2 -1.8 0 -2.5 -0.5 -2.5 -2z"/>
<path d="M12.8 4.3 c1.8 -0.2 4.5 -0.2 6 0 1.5 0.2 0 0.4 -3.3 0.4 -3.3 0 -4.5 -0.2 -2.7 -0.4z"/>
</g>
<g fill="#fcd801">
<path d="M13 14 c0 -5.7 0.1 -6 2.5 -6 2.4 0 2.5 0.3 2.5 6 0 5.7 -0.1 6 -2.5 6 -2.4 0 -2.5 -0.3 -2.5 -6z"/>
</g>
<g fill="#ada695">
<path d="M2.4 32.7 c-0.2 -0.7 -0.3 -7.8 -0.2 -15.7 l0.3 -14.5 15.5 0 15.5 0 0 15.5 0 15.5 -15.3 0.3 c-11.9 0.2 -15.4 0 -15.8 -1.1z m28.6 -14.7 l0 -13 -13 0 -13 0 0 13 0 13 13 0 13 0 0 -13z"/>
<path d="M8 26.5 c0 -2.2 0.4 -2.6 2.3 -2.3 1.4 0.2 2.2 1 2.2 2.3 0 1.3 -0.8 2.1 -2.2 2.3 -1.9 0.3 -2.3 -0.1 -2.3 -2.3z"/>
<path d="M15.4 27.5 c-0.8 -1.9 0.3 -3.5 2.5 -3.5 2.4 0 3 0.8 2.4 3.1 -0.6 2.2 -4.1 2.6 -4.9 0.4z"/>
<path d="M23.4 27.5 c-0.8 -2 0.4 -3.5 2.7 -3.5 1.4 0 1.9 0.7 1.9 2.5 0 1.8 -0.5 2.5 -2 2.5 -1.1 0 -2.3 -0.7 -2.6 -1.5z"/>
</g>
<g fill="#f0e5c8">
<path d="M3 18 l0 -15 15 0 15 0 0 15 0 15 -15 0 -15 0 0 -15z m29 0 l0 -14.1 -13.7 0.3 -13.8 0.3 -0.3 13.8 -0.3 13.7 14.1 0 14 0 0 -14z"/>
<path d="M8.2 26.3 c0.5 -2.6 3.8 -2.9 3.8 -0.4 0 1.5 -0.6 2.1 -2.1 2.1 -1.4 0 -1.9 -0.5 -1.7 -1.7z"/>
<path d="M16 26 c0 -1.3 0.7 -2 2 -2 1.3 0 2 0.7 2 2 0 1.3 -0.7 2 -2 2 -1.3 0 -2 -0.7 -2 -2z"/>
<path d="M24 25.9 c0 -2.5 3.3 -2.2 3.8 0.4 0.2 1.2 -0.3 1.7 -1.7 1.7 -1.5 0 -2.1 -0.6 -2.1 -2.1z"/>
</g>
</svg>

Before

Width:  |  Height:  |  Size: 4.1 KiB

View File

@@ -1,25 +0,0 @@
// Copyright (c) Microsoft Corporation
// The Microsoft Corporation licenses this file to you under the MIT license.
// See the LICENSE file in the project root for more information.
using Microsoft.CmdPal.Ext.PowerToys.Helper;
using Microsoft.CommandPalette.Extensions.Toolkit;
using static Common.UI.SettingsDeepLink;
namespace Microsoft.CmdPal.Ext.PowerToys.Classes;
internal sealed class PowerToysModuleEntry
{
public required SettingsWindow Module { get; set; }
public void NavigateToSettingsPage()
{
var moduleKey = Module.ModuleKey();
if (PowerToysRpcClient.TryInvoke(moduleKey, "navigateToSettings"))
{
return;
}
OpenSettings(Module);
}
}

View File

@@ -1,26 +0,0 @@
// Copyright (c) Microsoft Corporation
// The Microsoft Corporation licenses this file to you under the MIT license.
// See the LICENSE file in the project root for more information.
using Microsoft.CommandPalette.Extensions;
using Microsoft.CommandPalette.Extensions.Toolkit;
namespace Microsoft.CmdPal.Ext.PowerToys.Commands;
internal sealed partial class CopyColorCommand : InvokableCommand
{
private readonly Color _color;
public CopyColorCommand(Color color)
{
_color = color;
Name = $"Copy color #{color.R:X2}{color.G:X2}{color.B:X2}";
Icon = new IconInfo("\uE790"); // Color icon (more appropriate than copy icon)
}
public override ICommandResult Invoke()
{
ClipboardHelper.SetText($"#{_color.R:X2}{_color.G:X2}{_color.B:X2}");
return CommandResult.ShowToast($"Copied '#{_color.R:X2}{_color.G:X2}{_color.B:X2}' to clipboard");
}
}

View File

@@ -1,25 +0,0 @@
// Copyright (c) Microsoft Corporation
// The Microsoft Corporation licenses this file to you under the MIT license.
// See the LICENSE file in the project root for more information.
using Microsoft.CommandPalette.Extensions.Toolkit;
using PowerToys.Interop;
namespace Microsoft.CmdPal.Ext.PowerToys.Commands;
internal sealed partial class CrockAndLockReparentCommand : InvokableCommand
{
public CrockAndLockReparentCommand()
{
Icon = IconHelpers.FromRelativePath("Assets\\CropAndLock.png");
Name = "Crock and Lock (Reparent)";
Id = "com.microsoft.cmdpal.powertoys.crockandlock.reparent";
}
public override CommandResult Invoke()
{
using var eventHandle = new EventWaitHandle(false, EventResetMode.AutoReset, Constants.CropAndLockReparentEvent());
eventHandle.Set();
return CommandResult.Hide();
}
}

View File

@@ -1,25 +0,0 @@
// Copyright (c) Microsoft Corporation
// The Microsoft Corporation licenses this file to you under the MIT license.
// See the LICENSE file in the project root for more information.
using Microsoft.CommandPalette.Extensions.Toolkit;
using PowerToys.Interop;
namespace Microsoft.CmdPal.Ext.PowerToys.Commands;
internal sealed partial class CrockAndLockThumbnailCommand : InvokableCommand
{
public CrockAndLockThumbnailCommand()
{
Icon = IconHelpers.FromRelativePath("Assets\\CropAndLock.png");
Name = "Crock and Lock (Thumbnail)";
Id = "com.microsoft.cmdpal.powertoys.crockandlock.thumbnail";
}
public override CommandResult Invoke()
{
using var eventHandle = new EventWaitHandle(false, EventResetMode.AutoReset, Constants.CropAndLockThumbnailEvent());
eventHandle.Set();
return CommandResult.Hide();
}
}

View File

@@ -1,150 +0,0 @@
// Copyright (c) Microsoft Corporation
// The Microsoft Corporation licenses this file to you under the MIT license.
// See the LICENSE file in the project root for more information.
using System.Threading;
using Microsoft.CmdPal.Ext.PowerToys.Classes;
using Microsoft.CmdPal.Ext.PowerToys.Properties;
using Microsoft.CommandPalette.Extensions.Toolkit;
using PowerToys.Interop;
using static Common.UI.SettingsDeepLink;
using Workspaces.ModuleServices;
namespace Microsoft.CmdPal.Ext.PowerToys.Commands;
internal sealed partial class LaunchCommand : InvokableCommand
{
private readonly PowerToysModuleEntry _entry;
internal LaunchCommand(PowerToysModuleEntry entry)
{
_entry = entry;
Name = Resources.Launch_CommandName;
}
public override CommandResult Invoke()
{
switch (_entry.Module)
{
case SettingsWindow.ColorPicker:
{
using var eventHandle = new EventWaitHandle(false, EventResetMode.AutoReset, Constants.ShowColorPickerSharedEvent());
eventHandle.Set();
return CommandResult.KeepOpen();
}
case SettingsWindow.FancyZones:
{
using var eventHandle = new EventWaitHandle(false, EventResetMode.AutoReset, Constants.FZEToggleEvent());
eventHandle.Set();
return CommandResult.KeepOpen();
}
case SettingsWindow.ImageResizer:
{
// ImageResizer doesn't have a direct launch event, open settings instead
_entry.NavigateToSettingsPage();
return CommandResult.KeepOpen();
}
case SettingsWindow.KBM:
{
// Keyboard Manager doesn't have a direct launch event, open settings instead
_entry.NavigateToSettingsPage();
return CommandResult.KeepOpen();
}
case SettingsWindow.MouseUtils:
{
// Mouse Utils doesn't have a direct launch event, open settings instead
_entry.NavigateToSettingsPage();
return CommandResult.KeepOpen();
}
case SettingsWindow.PowerRename:
{
// PowerRename doesn't have a direct launch event, open settings instead
_entry.NavigateToSettingsPage();
return CommandResult.KeepOpen();
}
case SettingsWindow.Run:
{
using var eventHandle = new EventWaitHandle(false, EventResetMode.AutoReset, Constants.PowerLauncherSharedEvent());
eventHandle.Set();
return CommandResult.KeepOpen();
}
case SettingsWindow.PowerAccent:
{
// PowerAccent doesn't have a direct launch event, open settings instead
_entry.NavigateToSettingsPage();
return CommandResult.KeepOpen();
}
case SettingsWindow.Hosts:
{
using var eventHandle = new EventWaitHandle(false, EventResetMode.AutoReset, Constants.ShowHostsSharedEvent());
eventHandle.Set();
return CommandResult.KeepOpen();
}
case SettingsWindow.MeasureTool:
{
using var eventHandle = new EventWaitHandle(false, EventResetMode.AutoReset, Constants.MeasureToolTriggerEvent());
eventHandle.Set();
return CommandResult.KeepOpen();
}
case SettingsWindow.PowerOCR:
{
using var eventHandle = new EventWaitHandle(false, EventResetMode.AutoReset, Constants.ShowPowerOCRSharedEvent());
eventHandle.Set();
return CommandResult.KeepOpen();
}
case SettingsWindow.ShortcutGuide:
{
using var eventHandle = new EventWaitHandle(false, EventResetMode.AutoReset, Constants.ShortcutGuideTriggerEvent());
eventHandle.Set();
return CommandResult.KeepOpen();
}
case SettingsWindow.RegistryPreview:
{
using var eventHandle = new EventWaitHandle(false, EventResetMode.AutoReset, Constants.RegistryPreviewTriggerEvent());
eventHandle.Set();
return CommandResult.KeepOpen();
}
case SettingsWindow.CropAndLock:
{
using var eventHandle = new EventWaitHandle(false, EventResetMode.AutoReset, Constants.CropAndLockThumbnailEvent());
eventHandle.Set();
return CommandResult.KeepOpen();
}
case SettingsWindow.EnvironmentVariables:
{
using var eventHandle = new EventWaitHandle(false, EventResetMode.AutoReset, Constants.ShowEnvironmentVariablesSharedEvent());
eventHandle.Set();
return CommandResult.KeepOpen();
}
case SettingsWindow.Workspaces:
{
var result = WorkspaceService.Instance.LaunchEditorAsync().GetAwaiter().GetResult();
return result.Success
? CommandResult.KeepOpen()
: CommandResult.ShowToast(result.Error ?? "Failed to launch Workspaces editor.");
}
default:
{
// For modules without specific launch events, open settings page
_entry.NavigateToSettingsPage();
return CommandResult.KeepOpen();
}
}
}
}

View File

@@ -1,30 +0,0 @@
// Copyright (c) Microsoft Corporation
// The Microsoft Corporation licenses this file to you under the MIT license.
// See the LICENSE file in the project root for more information.
using Microsoft.CommandPalette.Extensions.Toolkit;
using Workspaces.ModuleServices;
namespace Microsoft.CmdPal.Ext.PowerToys.Commands;
// Responsible for launch a specific workspace
internal sealed partial class LaunchWorkspaceCommand : InvokableCommand
{
private readonly string _workspaceId;
public LaunchWorkspaceCommand(string workspaceId)
{
_workspaceId = workspaceId;
}
public override CommandResult Invoke()
{
var result = WorkspaceService.Instance.LaunchWorkspaceAsync(_workspaceId).GetAwaiter().GetResult();
if (!result.Success)
{
return CommandResult.ShowToast(result.Error ?? "Failed to launch workspace.");
}
return CommandResult.KeepOpen();
}
}

View File

@@ -1,26 +0,0 @@
// Copyright (c) Microsoft Corporation
// The Microsoft Corporation licenses this file to you under the MIT license.
// See the LICENSE file in the project root for more information.
using Microsoft.CmdPal.Ext.PowerToys.Classes;
using Microsoft.CmdPal.Ext.PowerToys.Properties;
using Microsoft.CommandPalette.Extensions.Toolkit;
namespace Microsoft.CmdPal.Ext.PowerToys.Commands;
internal sealed partial class OpenInSettingsCommand : InvokableCommand
{
private readonly PowerToysModuleEntry _entry;
public OpenInSettingsCommand(PowerToysModuleEntry entry)
{
_entry = entry;
Name = Resources.OpenInSettings_CommandName;
}
public override CommandResult Invoke()
{
_entry.NavigateToSettingsPage();
return CommandResult.KeepOpen();
}
}

View File

@@ -1,19 +0,0 @@
// Copyright (c) Microsoft Corporation
// The Microsoft Corporation licenses this file to you under the MIT license.
// See the LICENSE file in the project root for more information.
using System;
using Microsoft.CommandPalette.Extensions;
using Microsoft.CommandPalette.Extensions.Toolkit;
namespace Microsoft.CmdPal.Ext.PowerToys.Helper;
// Placeholder helper for Awake commands; currently returns no items.
internal static class AwakeItemsHelper
{
public static IListItem[] FilteredItems(string? query)
{
// Future Awake quick actions can be returned here when implemented.
return Array.Empty<IListItem>();
}
}

View File

@@ -1,100 +0,0 @@
// Copyright (c) Microsoft Corporation
// The Microsoft Corporation licenses this file to you under the MIT license.
// See the LICENSE file in the project root for more information.
using System.Drawing;
using System.Drawing.Drawing2D;
using System.Drawing.Imaging;
using System.Globalization;
using System.Text.Json;
using Microsoft.CmdPal.Ext.PowerToys.Commands;
using Microsoft.CommandPalette.Extensions;
using Microsoft.CommandPalette.Extensions.Toolkit;
using Windows.Storage.Streams;
using Color = Microsoft.CommandPalette.Extensions.Color;
namespace Microsoft.CmdPal.Ext.PowerToys.Helper;
internal sealed class ColorPickerHelper
{
private const string ColorPickerHistoryFilename = "colorHistory.json";
private const string ColorPickerModuleName = "ColorPicker";
internal static List<string> LoadSavedColors()
{
var localAppData = Environment.GetFolderPath(Environment.SpecialFolder.LocalApplicationData);
var historyFile = Path.Combine(localAppData, "Microsoft", "PowerToys", ColorPickerModuleName, ColorPickerHistoryFilename);
if (!File.Exists(historyFile))
{
return [];
}
var jsonSettingsString = System.IO.File.ReadAllText(historyFile).Trim('\0');
return JsonSerializer.Deserialize<List<string>>(jsonSettingsString, PowerToysJsonContext.Default.ListString) ?? [];
}
public static async Task<IconInfo> CreateColorCircleIcon(System.Drawing.Color color)
{
const int iconSize = 32;
using var bitmap = new Bitmap(iconSize, iconSize, PixelFormat.Format32bppArgb);
using (var graphics = System.Drawing.Graphics.FromImage(bitmap))
{
graphics.SmoothingMode = SmoothingMode.AntiAlias;
graphics.InterpolationMode = InterpolationMode.HighQualityBicubic;
graphics.PixelOffsetMode = PixelOffsetMode.HighQuality;
graphics.Clear(System.Drawing.Color.Transparent);
using var brush = new SolidBrush(color);
graphics.FillEllipse(brush, 2, 2, iconSize - 4, iconSize - 4);
using var pen = new Pen(System.Drawing.Color.FromArgb(128, 0, 0, 0), 1);
graphics.DrawEllipse(pen, 2, 2, iconSize - 4, iconSize - 4);
}
using var memoryStream = new MemoryStream();
bitmap.Save(memoryStream, ImageFormat.Png);
memoryStream.Position = 0;
var randomAccessStream = new InMemoryRandomAccessStream();
using var outputStream = randomAccessStream.GetOutputStreamAt(0);
using var dataWriter = new DataWriter(outputStream);
dataWriter.WriteBytes(memoryStream.ToArray());
await dataWriter.StoreAsync();
await dataWriter.FlushAsync();
return IconInfo.FromStream(randomAccessStream);
}
internal static IListItem[] GetColorItems(string searchText)
{
var colorItems = new List<ListItem>();
foreach (var colorItem in LoadSavedColors())
{
var parts = colorItem.Split('|');
var color = new Color()
{
A = byte.Parse(parts[0], NumberStyles.Integer, CultureInfo.InvariantCulture),
R = byte.Parse(parts[1], NumberStyles.Integer, CultureInfo.InvariantCulture),
G = byte.Parse(parts[2], NumberStyles.Integer, CultureInfo.InvariantCulture),
B = byte.Parse(parts[3], NumberStyles.Integer, CultureInfo.InvariantCulture),
};
var item = new ListItem(new CopyColorCommand(color))
{
Icon = CreateColorCircleIcon(System.Drawing.Color.FromArgb(color.A, color.R, color.G, color.B)).GetAwaiter().GetResult(),
Title = $"#{color.R:X2}{color.G:X2}{color.B:X2}",
Subtitle = "Copy color",
};
if (item.Title.Contains(searchText))
{
colorItems.Add(item);
}
}
return [.. colorItems];
}
}

View File

@@ -1,45 +0,0 @@
// Copyright (c) Microsoft Corporation
// The Microsoft Corporation licenses this file to you under the MIT license.
// See the LICENSE file in the project root for more information.
using Microsoft.CmdPal.Ext.PowerToys.Classes;
using Microsoft.CmdPal.Ext.PowerToys.Commands;
using Microsoft.CmdPal.Ext.PowerToys.Pages;
using Microsoft.CommandPalette.Extensions;
using Microsoft.CommandPalette.Extensions.Toolkit;
using static Common.UI.SettingsDeepLink;
namespace Microsoft.CmdPal.Ext.PowerToys.Helper;
internal static class CommandsHelper
{
public static IList<ICommandContextItem> GetCommands(this PowerToysModuleEntry entry)
{
switch (entry.Module)
{
case SettingsWindow.ColorPicker:
return new List<ICommandContextItem>()
{
new CommandContextItem(new ColorPickerListPage()),
};
case SettingsWindow.CropAndLock:
return new List<ICommandContextItem>()
{
new CommandContextItem(new CrockAndLockThumbnailCommand()),
new CommandContextItem(new CrockAndLockReparentCommand()),
};
case SettingsWindow.Awake:
return new List<ICommandContextItem>()
{
new CommandContextItem(new AwakePage()),
};
case SettingsWindow.Workspaces:
return new List<ICommandContextItem>()
{
new CommandContextItem(new WorkspacesListPage()),
};
default:
return new List<ICommandContextItem>();
}
}
}

View File

@@ -1,182 +0,0 @@
// Copyright (c) Microsoft Corporation
// The Microsoft Corporation licenses this file to you under the MIT license.
// See the LICENSE file in the project root for more information.
using Common.Search.FuzzSearch;
using Microsoft.CmdPal.Ext.PowerToys.Classes;
using Microsoft.CmdPal.Ext.PowerToys.Commands;
using Microsoft.CmdPal.Ext.PowerToys.Pages;
using Microsoft.CommandPalette.Extensions;
using Microsoft.CommandPalette.Extensions.Toolkit;
using static Common.UI.SettingsDeepLink;
namespace Microsoft.CmdPal.Ext.PowerToys.Helper;
// A helper class for module items.
internal static class ModuleItemsHelper
{
private static List<ListItem>? _allItemsCache;
public static ListItem? CreateCommandItem(this SettingsWindow module)
{
switch (module)
{
// These modules have their own UI
case SettingsWindow.Workspaces:
{
var entry = new PowerToysModuleEntry
{
Module = module,
};
var primary = new CommandItem(new LaunchCommand(entry))
{
Title = module.ModuleName(),
Icon = module.ModuleIcon(),
};
var moreCommands = new List<ICommandContextItem>
{
.. entry.GetCommands(),
new CommandContextItem(new OpenInSettingsCommand(entry)),
};
return new ListItem(primary)
{
Icon = module.ModuleIcon(),
Title = module.ModuleName(),
MoreCommands = moreCommands.ToArray(),
};
}
case SettingsWindow.CropAndLock:
{
var entry = new PowerToysModuleEntry
{
Module = module,
};
var primary = new CommandItem(new LaunchCommand(entry))
{
Title = module.ModuleName(),
Icon = module.ModuleIcon(),
};
var moreCommands = new List<ICommandContextItem>
{
.. entry.GetCommands(),
new CommandContextItem(new OpenInSettingsCommand(entry)),
};
return new ListItem(primary)
{
Icon = module.ModuleIcon(),
Title = module.ModuleName(),
MoreCommands = moreCommands.ToArray(),
};
}
case SettingsWindow.FancyZones:
case SettingsWindow.KBM:
case SettingsWindow.Hosts:
case SettingsWindow.EnvironmentVariables:
case SettingsWindow.RegistryPreview:
case SettingsWindow.ShortcutGuide:
case SettingsWindow.Awake:
case SettingsWindow.ColorPicker:
case SettingsWindow.Run:
case SettingsWindow.ImageResizer:
case SettingsWindow.MouseUtils:
case SettingsWindow.PowerRename:
case SettingsWindow.FileExplorer:
case SettingsWindow.MeasureTool:
case SettingsWindow.PowerOCR:
case SettingsWindow.AdvancedPaste:
case SettingsWindow.CmdPal:
case SettingsWindow.ZoomIt:
case SettingsWindow.AlwaysOnTop:
case SettingsWindow.FileLocksmith:
case SettingsWindow.NewPlus:
case SettingsWindow.Peek:
case SettingsWindow.CmdNotFound:
case SettingsWindow.MouseWithoutBorders:
case SettingsWindow.PowerAccent:
case SettingsWindow.PowerLauncher:
{
var entry = new PowerToysModuleEntry
{
Module = module,
};
var primary = new CommandItem(new LaunchCommand(entry))
{
Title = module.ModuleName(),
Icon = module.ModuleIcon(),
};
var moreCommands = new List<ICommandContextItem>
{
.. entry.GetCommands(),
new CommandContextItem(new OpenInSettingsCommand(entry)),
};
return new ListItem(primary)
{
Icon = module.ModuleIcon(),
Title = module.ModuleName(),
MoreCommands = moreCommands.ToArray(),
};
}
case SettingsWindow.Overview:
case SettingsWindow.Dashboard:
// duplicated with file explorer add on.
case SettingsWindow.PowerPreview:
return null;
default:
throw new NotImplementedException();
}
}
public static List<ListItem> AllItems()
{
if (_allItemsCache is not null)
{
return _allItemsCache;
}
var items = new List<ListItem>();
foreach (var module in Enum.GetValues<SettingsWindow>())
{
var item = module.CreateCommandItem();
if (item != null)
{
items.Add(item);
}
}
_allItemsCache = items;
return items;
}
public static IListItem[] FilteredItems(string query)
{
var allItems = AllItems();
if (string.IsNullOrWhiteSpace(query))
{
return [.. allItems];
}
var matched = new List<Tuple<int, ListItem>>();
foreach (var item in allItems)
{
var matchResult = StringMatcher.FuzzyMatch(query, item.Title);
if (matchResult.Success)
{
matched.Add(new Tuple<int, ListItem>(matchResult.Score, item));
}
}
matched.Sort((x, y) => y.Item1.CompareTo(x.Item1));
return [.. matched.Select(x => x.Item2)];
}
}

View File

@@ -1,19 +0,0 @@
// Copyright (c) Microsoft Corporation
// The Microsoft Corporation licenses this file to you under the MIT license.
// See the LICENSE file in the project root for more information.
using System.Text.Json.Serialization;
namespace Microsoft.CmdPal.Ext.PowerToys.Helper;
// Source-generated JSON serialization context
[JsonSerializable(typeof(WorkspaceItemsHelper.WorkspacesData))]
[JsonSerializable(typeof(WorkspaceItemsHelper.WorkspaceProject))]
[JsonSerializable(typeof(WorkspaceItemsHelper.WorkspaceApplication))]
[JsonSerializable(typeof(List<string>))]
[JsonSourceGenerationOptions(
PropertyNamingPolicy = JsonKnownNamingPolicy.CamelCase,
PropertyNameCaseInsensitive = true)]
internal sealed partial class PowerToysJsonContext : JsonSerializerContext
{
}

View File

@@ -1,140 +0,0 @@
// Copyright (c) Microsoft Corporation
// The Microsoft Corporation licenses this file to you under the MIT license.
// See the LICENSE file in the project root for more information.
using System.Diagnostics;
using Microsoft.CommandPalette.Extensions.Toolkit;
using static Common.UI.SettingsDeepLink;
namespace Microsoft.CmdPal.Ext.PowerToys.Helper;
public static class PowerToysResourcesHelper
{
public static IconInfo ProviderIcon()
{
var iconpath = IconHelpers.FromRelativePath("Assets\\PowerToys.svg");
Debug.WriteLine(iconpath);
return IconHelpers.FromRelativePath("Assets\\PowerToys.svg");
}
public static IconInfo ModuleIcon(this SettingsWindow module)
{
var iconPath = module switch
{
SettingsWindow.ColorPicker => "Assets\\ColorPicker.png",
SettingsWindow.FancyZones => "Assets\\FancyZones.png",
SettingsWindow.Hosts => "Assets\\Hosts.png",
SettingsWindow.PowerOCR => "Assets\\PowerOcr.png",
SettingsWindow.RegistryPreview => "Assets\\RegistryPreview.png",
SettingsWindow.MeasureTool => "Assets\\ScreenRuler.png",
SettingsWindow.ShortcutGuide => "Assets\\ShortcutGuide.png",
SettingsWindow.CropAndLock => "Assets\\CropAndLock.png",
SettingsWindow.EnvironmentVariables => "Assets\\EnvironmentVariables.png",
SettingsWindow.Awake => "Assets\\Awake.png",
SettingsWindow.PowerRename => "Assets\\PowerRename.png",
SettingsWindow.Run => "Assets\\PowerToysRun.png",
SettingsWindow.ImageResizer => "Assets\\ImageResizer.png",
SettingsWindow.KBM => "Assets\\KeyboardManager.png",
SettingsWindow.MouseUtils => "Assets\\MouseUtils.png",
SettingsWindow.Workspaces => "Assets\\Workspaces.png",
SettingsWindow.AdvancedPaste => "Assets\\AdvancedPaste.png",
SettingsWindow.CmdPal => "Assets\\CmdPal.png",
SettingsWindow.ZoomIt => "Assets\\ZoomIt.png",
SettingsWindow.FileExplorer => "Assets\\FileExplorerPreview.png",
SettingsWindow.FileLocksmith => "Assets\\FileLockSmith.png",
SettingsWindow.NewPlus => "Assets\\NewPlus.png",
SettingsWindow.Peek => "Assets\\Peek.png",
SettingsWindow.AlwaysOnTop => "Assets\\AlwaysOnTop.png",
SettingsWindow.CmdNotFound => "Assets\\CommandNotFound.png",
SettingsWindow.MouseWithoutBorders => "Assets\\MouseWithoutBorders.png",
SettingsWindow.PowerAccent => "Assets\\QuickAccent.png",
SettingsWindow.PowerLauncher => "Assets\\PowerToysRun.png",
SettingsWindow.PowerPreview => "Assets\\FileExplorerPreview.png",
SettingsWindow.Overview => string.Empty,
SettingsWindow.Dashboard => string.Empty,
_ => throw new NotImplementedException(),
};
return IconHelpers.FromRelativePath(iconPath);
}
public static string ModuleName(this SettingsWindow module)
{
return module switch
{
SettingsWindow.ColorPicker => "Color Picker",
SettingsWindow.FancyZones => "FancyZones",
SettingsWindow.Hosts => "Hosts File Editor",
SettingsWindow.PowerOCR => "Text Extractor",
SettingsWindow.RegistryPreview => "Registry Preview",
SettingsWindow.MeasureTool => "Screen Ruler",
SettingsWindow.ShortcutGuide => "Shortcut Guide",
SettingsWindow.CropAndLock => "Crop And Lock",
SettingsWindow.EnvironmentVariables => "Environment Variables",
SettingsWindow.Awake => "Awake",
SettingsWindow.PowerRename => "PowerRename",
SettingsWindow.Run => "PowerToys Run",
SettingsWindow.ImageResizer => "Image Resizer",
SettingsWindow.KBM => "Keyboard Manager",
SettingsWindow.MouseUtils => "Mouse Utilities",
SettingsWindow.Workspaces => "Workspaces",
SettingsWindow.AdvancedPaste => "Advanced Paste",
SettingsWindow.CmdPal => "Command Palette",
SettingsWindow.ZoomIt => "ZoomIt",
SettingsWindow.FileExplorer => "File Explorer Add-ons",
SettingsWindow.FileLocksmith => "File Locksmith",
SettingsWindow.NewPlus => "New+",
SettingsWindow.Peek => "Peek",
SettingsWindow.AlwaysOnTop => "Always On Top",
SettingsWindow.CmdNotFound => "Command Not Found",
SettingsWindow.MouseWithoutBorders => "Mouse Without Borders",
SettingsWindow.PowerAccent => "Quick Accent",
SettingsWindow.Overview => "General",
SettingsWindow.Dashboard => "Dashboard",
SettingsWindow.PowerLauncher => "PowerToys Run",
SettingsWindow.PowerPreview => "File Explorer Add-ons",
_ => throw new NotImplementedException(),
};
}
public static string ModuleKey(this SettingsWindow module)
{
return module switch
{
SettingsWindow.Dashboard => "Dashboard",
SettingsWindow.Overview => "Overview",
SettingsWindow.AlwaysOnTop => "AlwaysOnTop",
SettingsWindow.Awake => "Awake",
SettingsWindow.ColorPicker => "ColorPicker",
SettingsWindow.CmdNotFound => "CmdNotFound",
SettingsWindow.LightSwitch => "LightSwitch",
SettingsWindow.FancyZones => "FancyZones",
SettingsWindow.FileLocksmith => "FileLocksmith",
SettingsWindow.Run => "Run",
SettingsWindow.ImageResizer => "ImageResizer",
SettingsWindow.KBM => "KBM",
SettingsWindow.MouseUtils => "MouseUtils",
SettingsWindow.MouseWithoutBorders => "MouseWithoutBorders",
SettingsWindow.Peek => "Peek",
SettingsWindow.PowerAccent => "PowerAccent",
SettingsWindow.PowerLauncher => "PowerLauncher",
SettingsWindow.PowerPreview => "PowerPreview",
SettingsWindow.PowerRename => "PowerRename",
SettingsWindow.FileExplorer => "FileExplorer",
SettingsWindow.ShortcutGuide => "ShortcutGuide",
SettingsWindow.Hosts => "Hosts",
SettingsWindow.MeasureTool => "MeasureTool",
SettingsWindow.PowerOCR => "PowerOcr",
SettingsWindow.Workspaces => "Workspaces",
SettingsWindow.RegistryPreview => "RegistryPreview",
SettingsWindow.CropAndLock => "CropAndLock",
SettingsWindow.EnvironmentVariables => "EnvironmentVariables",
SettingsWindow.AdvancedPaste => "AdvancedPaste",
SettingsWindow.NewPlus => "NewPlus",
SettingsWindow.CmdPal => "CmdPal",
SettingsWindow.ZoomIt => "ZoomIt",
_ => throw new NotImplementedException(),
};
}
}

View File

@@ -1,92 +0,0 @@
// Copyright (c) Microsoft Corporation
// The Microsoft Corporation licenses this file to you under the MIT license.
// See the LICENSE file in the project root for more information.
using System;
using System.IO;
using System.IO.Pipes;
using System.Text;
using System.Text.Json;
using System.Text.Json.Serialization;
namespace Microsoft.CmdPal.Ext.PowerToys.Helper;
internal static class PowerToysRpcClient
{
private const string PipeName = "PowerToys.CmdPal.Rpc";
public static bool TryInvoke(string module, string method, object? parameters = null, int timeoutMs = 5000)
{
var request = new RpcRequest
{
Module = module,
Method = method,
Parameters = parameters ?? new { },
TimeoutMs = timeoutMs,
};
try
{
using var pipe = new NamedPipeClientStream(".", PipeName, PipeDirection.InOut, PipeOptions.None);
pipe.Connect(timeoutMs);
var payload = JsonSerializer.SerializeToUtf8Bytes(request, PowerToysRpcClientContext.Default.RpcRequest);
using (var writer = new BinaryWriter(pipe, Encoding.UTF8, leaveOpen: true))
{
writer.Write(payload.Length);
writer.Flush();
}
pipe.Write(payload, 0, payload.Length);
pipe.Flush();
using var reader = new BinaryReader(pipe, Encoding.UTF8, leaveOpen: true);
var responseLength = reader.ReadInt32();
if (responseLength <= 0)
{
return false;
}
var buffer = new byte[responseLength];
var totalRead = 0;
while (totalRead < responseLength)
{
var read = pipe.Read(buffer, totalRead, responseLength - totalRead);
if (read == 0)
{
return false;
}
totalRead += read;
}
using var document = JsonDocument.Parse(buffer);
return document.RootElement.TryGetProperty("ok", out var okProperty) && okProperty.GetBoolean();
}
catch
{
return false;
}
}
internal sealed class RpcRequest
{
[JsonPropertyName("version")]
public string Version { get; init; } = "1.0";
[JsonPropertyName("id")]
public string Id { get; init; } = Guid.NewGuid().ToString();
[JsonPropertyName("module")]
public string Module { get; init; } = string.Empty;
[JsonPropertyName("method")]
public string Method { get; init; } = string.Empty;
[JsonPropertyName("params")]
public object Parameters { get; init; } = new { };
[JsonPropertyName("timeoutMs")]
public int TimeoutMs { get; init; }
}
}

View File

@@ -1,13 +0,0 @@
// Copyright (c) Microsoft Corporation
// The Microsoft Corporation licenses this file to you under the MIT license.
// See the LICENSE file in the project root for more information.
using System.Text.Json.Serialization;
namespace Microsoft.CmdPal.Ext.PowerToys.Helper;
[JsonSourceGenerationOptions(GenerationMode = JsonSourceGenerationMode.Default)]
[JsonSerializable(typeof(PowerToysRpcClient.RpcRequest))]
internal sealed partial class PowerToysRpcClientContext : JsonSerializerContext
{
}

View File

@@ -1,130 +0,0 @@
// Copyright (c) Microsoft Corporation
// The Microsoft Corporation licenses this file to you under the MIT license.
// See the LICENSE file in the project root for more information.
using System.Text.Json;
using Common.Search.FuzzSearch;
using ManagedCommon;
using Microsoft.CmdPal.Ext.PowerToys.Commands;
using Microsoft.CommandPalette.Extensions;
using Microsoft.CommandPalette.Extensions.Toolkit;
namespace Microsoft.CmdPal.Ext.PowerToys.Helper;
// A helper class for workspace items.
internal static class WorkspaceItemsHelper
{
// Simple classes to deserialize workspace data
internal sealed class WorkspaceProject
{
public string Id { get; set; } = string.Empty;
public string Name { get; set; } = string.Empty;
public List<WorkspaceApplication> Applications { get; set; } = new();
}
internal sealed class WorkspaceApplication
{
public string Application { get; set; } = string.Empty;
}
internal sealed class WorkspacesData
{
public List<WorkspaceProject> Workspaces { get; set; } = new();
}
public static List<ListItem> AllWorkspaces()
{
var items = new List<ListItem>();
try
{
var workspacesFilePath = GetWorkspacesFilePath();
if (!File.Exists(workspacesFilePath))
{
return items;
}
var jsonContent = File.ReadAllText(workspacesFilePath);
var workspacesData = JsonSerializer.Deserialize(jsonContent, PowerToysJsonContext.Default.WorkspacesData);
if (workspacesData?.Workspaces == null)
{
return items;
}
foreach (var project in workspacesData.Workspaces)
{
if (string.IsNullOrEmpty(project.Id) || string.IsNullOrEmpty(project.Name))
{
continue;
}
var item = new ListItem(new LaunchWorkspaceCommand(project.Id))
{
// Icon = IconHelpers.FromRelativePath("Assets\\Workspaces.svg"),
Title = project.Name,
Subtitle = GetWorkspaceSubtitle(project),
};
items.Add(item);
}
}
catch (Exception ex)
{
Logger.LogError($"Error loading workspaces: {ex.Message}");
}
return items;
}
public static IListItem[] FilteredItems(string query)
{
var allItems = AllWorkspaces();
if (string.IsNullOrWhiteSpace(query))
{
return [.. allItems];
}
var matched = new List<Tuple<int, ListItem>>();
foreach (var item in allItems)
{
var matchResult = StringMatcher.FuzzyMatch(query, item.Title);
if (matchResult.Success)
{
matched.Add(new Tuple<int, ListItem>(matchResult.Score, item));
}
}
matched.Sort((x, y) => y.Item1.CompareTo(x.Item1));
return [.. matched.Select(x => x.Item2)];
}
private static string GetWorkspacesFilePath()
{
var localAppData = Environment.GetFolderPath(Environment.SpecialFolder.LocalApplicationData);
return Path.Combine(localAppData, "Microsoft", "PowerToys", "Workspaces", "workspaces.json");
}
private static string GetWorkspaceSubtitle(WorkspaceProject project)
{
var appCount = project.Applications?.Count ?? 0;
if (appCount == 0)
{
return "No applications";
}
else if (appCount == 1)
{
return "1 application";
}
else
{
return $"{appCount} applications";
}
}
}

View File

@@ -1,164 +0,0 @@
<Project Sdk="Microsoft.NET.Sdk">
<Import Project="..\..\..\..\Common.Dotnet.CsWinRT.props" />
<Import Project="..\..\..\..\Common.Dotnet.AotCompatibility.props" />
<PropertyGroup>
<RootNamespace>Microsoft.CmdPal.Ext.PowerToys.Host</RootNamespace>
<ImplicitUsings>enable</ImplicitUsings>
<AppendTargetFrameworkToOutputPath>false</AppendTargetFrameworkToOutputPath>
<AppendRuntimeIdentifierToOutputPath>false</AppendRuntimeIdentifierToOutputPath>
<Nullable>enable</Nullable>
<PublishAot>true</PublishAot>
<OutputPath>$(SolutionDir)$(Platform)\$(Configuration)\WinUI3Apps\CmdPal</OutputPath>
<InvariantGlobalization>true</InvariantGlobalization>
</PropertyGroup>
<ItemGroup>
<ProjectReference Include="..\..\..\..\common\Common.Search\Common.Search.csproj" />
<ProjectReference Include="..\..\..\..\common\Common.UI\Common.UI.csproj" />
<ProjectReference Include="..\..\..\..\common\ManagedCommon\ManagedCommon.csproj" />
<ProjectReference Include="..\..\..\..\settings-ui\Settings.UI.Library\Settings.UI.Library.csproj" />
<ProjectReference Include="..\..\..\..\modules\workspaces\Workspaces.ModuleServices\Workspaces.ModuleServices.csproj" />
<ProjectReference Include="..\..\..\..\common\PowerToys.ModuleContracts\PowerToys.ModuleContracts.csproj" />
<ProjectReference Include="..\..\extensionsdk\Microsoft.CommandPalette.Extensions.Toolkit\Microsoft.CommandPalette.Extensions.Toolkit.csproj" />
</ItemGroup>
<ItemGroup>
<Compile Update="Properties\Resources.Designer.cs">
<DesignTime>True</DesignTime>
<AutoGen>True</AutoGen>
<DependentUpon>Resources.resx</DependentUpon>
</Compile>
</ItemGroup>
<ItemGroup>
<None Remove="Assets\PowerToys.svg" />
</ItemGroup>
<ItemGroup>
<Content Update="Assets\PowerToys.png">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</Content>
<Content Update="Assets\PowerToys.svg">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</Content>
</ItemGroup>
<ItemGroup>
<Content Include="..\..\..\..\settings-ui\Settings.UI\Assets\Settings\Icons\ColorPicker.png">
<Link>Assets\ColorPicker.png</Link>
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</Content>
<Content Include="..\..\..\..\settings-ui\Settings.UI\Assets\Settings\Icons\FancyZones.png">
<Link>Assets\FancyZones.png</Link>
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</Content>
<Content Include="..\..\..\..\settings-ui\Settings.UI\Assets\Settings\Icons\CropAndLock.png">
<Link>Assets\CropAndLock.png</Link>
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</Content>
<Content Include="..\..\..\..\settings-ui\Settings.UI\Assets\Settings\Icons\Hosts.png">
<Link>Assets\Hosts.png</Link>
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</Content>
<Content Include="..\..\..\..\settings-ui\Settings.UI\Assets\Settings\Icons\TextExtractor.png">
<Link>Assets\PowerOcr.png</Link>
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</Content>
<Content Include="..\..\..\..\settings-ui\Settings.UI\Assets\Settings\Icons\RegistryPreview.png">
<Link>Assets\RegistryPreview.png</Link>
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</Content>
<Content Include="..\..\..\..\settings-ui\Settings.UI\Assets\Settings\Icons\ScreenRuler.png">
<Link>Assets\ScreenRuler.png</Link>
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</Content>
<Content Include="..\..\..\..\settings-ui\Settings.UI\Assets\Settings\Icons\ShortcutGuide.png">
<Link>Assets\ShortcutGuide.png</Link>
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</Content>
<Content Include="..\..\..\..\settings-ui\Settings.UI\Assets\Settings\Icons\EnvironmentVariables.png">
<Link>Assets\EnvironmentVariables.png</Link>
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</Content>
<Content Include="..\..\..\..\settings-ui\Settings.UI\Assets\Settings\Icons\Workspaces.png">
<Link>Assets\Workspaces.png</Link>
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</Content>
<Content Include="..\..\..\..\settings-ui\Settings.UI\Assets\Settings\Icons\Awake.png">
<Link>Assets\Awake.png</Link>
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</Content>
<Content Include="..\..\..\..\settings-ui\Settings.UI\Assets\Settings\Icons\PowerRename.png">
<Link>Assets\PowerRename.png</Link>
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</Content>
<Content Include="..\..\..\..\settings-ui\Settings.UI\Assets\Settings\Icons\PowerToysRun.png">
<Link>Assets\PowerToysRun.png</Link>
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</Content>
<Content Include="..\..\..\..\settings-ui\Settings.UI\Assets\Settings\Icons\ImageResizer.png">
<Link>Assets\ImageResizer.png</Link>
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</Content>
<Content Include="..\..\..\..\settings-ui\Settings.UI\Assets\Settings\Icons\KeyboardManager.png">
<Link>Assets\KeyboardManager.png</Link>
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</Content>
<Content Include="..\..\..\..\settings-ui\Settings.UI\Assets\Settings\Icons\MouseUtils.png">
<Link>Assets\MouseUtils.png</Link>
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</Content>
<Content Include="..\..\..\..\settings-ui\Settings.UI\Assets\Settings\Icons\AdvancedPaste.png">
<Link>Assets\AdvancedPaste.png</Link>
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</Content>
<Content Include="..\..\..\..\settings-ui\Settings.UI\Assets\Settings\Icons\CmdPal.png">
<Link>Assets\CmdPal.png</Link>
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</Content>
<Content Include="..\..\..\..\settings-ui\Settings.UI\Assets\Settings\Icons\ZoomIt.png">
<Link>Assets\ZoomIt.png</Link>
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</Content>
<Content Include="..\..\..\..\settings-ui\Settings.UI\Assets\Settings\Icons\FileExplorerPreview.png">
<Link>Assets\FileExplorerPreview.png</Link>
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</Content>
<Content Include="..\..\..\..\settings-ui\Settings.UI\Assets\Settings\Icons\FileLocksmith.png">
<Link>Assets\FileLockSmith.png</Link>
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</Content>
<Content Include="..\..\..\..\settings-ui\Settings.UI\Assets\Settings\Icons\NewPlus.png">
<Link>Assets\NewPlus.png</Link>
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</Content>
<Content Include="..\..\..\..\settings-ui\Settings.UI\Assets\Settings\Icons\Peek.png">
<Link>Assets\Peek.png</Link>
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</Content>
<Content Include="..\..\..\..\settings-ui\Settings.UI\Assets\Settings\Icons\AlwaysOnTop.png">
<Link>Assets\AlwaysOnTop.png</Link>
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</Content>
<Content Include="..\..\..\..\settings-ui\Settings.UI\Assets\Settings\Icons\CommandNotFound.png">
<Link>Assets\CommandNotFound.png</Link>
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</Content>
<Content Include="..\..\..\..\settings-ui\Settings.UI\Assets\Settings\Icons\MouseWithoutBorders.png">
<Link>Assets\MouseWithoutBorders.png</Link>
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</Content>
<Content Include="..\..\..\..\settings-ui\Settings.UI\Assets\Settings\Icons\QuickAccent.png">
<Link>Assets\QuickAccent.png</Link>
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</Content>
</ItemGroup>
<ItemGroup>
<PackageReference Include="System.Drawing.Common" />
</ItemGroup>
<ItemGroup>
<EmbeddedResource Update="Properties\Resources.resx">
<Generator>ResXFileCodeGenerator</Generator>
<LastGenOutput>Resources.Designer.cs</LastGenOutput>
</EmbeddedResource>
</ItemGroup>
</Project>

View File

@@ -1,38 +0,0 @@
// Copyright (c) Microsoft Corporation
// The Microsoft Corporation licenses this file to you under the MIT license.
// See the LICENSE file in the project root for more information.
using System.Drawing;
using Microsoft.CmdPal.Ext.PowerToys.Helper;
using Microsoft.CommandPalette.Extensions;
using Microsoft.CommandPalette.Extensions.Toolkit;
namespace Microsoft.CmdPal.Ext.PowerToys.Pages;
internal sealed partial class AwakePage : DynamicListPage
{
public AwakePage()
{
Icon = IconHelpers.FromRelativePath("Assets\\Awake.png");
Name = Title = "Awake";
Id = "com.microsoft.cmdpal.powertoys.awake";
EmptyContent = new CommandItem()
{
Icon = Icon,
Title = "No Awake actions available",
Subtitle = SearchText,
};
}
public override void UpdateSearchText(string oldSearch, string newSearch)
{
if (EmptyContent is CommandItem empty)
{
empty.Subtitle = newSearch;
}
RaiseItemsChanged(0);
return;
}
public override IListItem[] GetItems() => AwakeItemsHelper.FilteredItems(SearchText);
}

View File

@@ -1,38 +0,0 @@
// Copyright (c) Microsoft Corporation
// The Microsoft Corporation licenses this file to you under the MIT license.
// See the LICENSE file in the project root for more information.
using System.Diagnostics.CodeAnalysis;
using Microsoft.CmdPal.Ext.PowerToys.Helper;
using Microsoft.CommandPalette.Extensions;
using Microsoft.CommandPalette.Extensions.Toolkit;
namespace Microsoft.CmdPal.Ext.PowerToys.Pages;
internal sealed partial class ColorPickerListPage : DynamicListPage
{
private readonly CommandItem _emptyMessage;
public ColorPickerListPage()
{
Icon = new IconInfo("\uE790");
Name = Title = "Saved colors";
Id = "com.microsoft.cmdpal.powertoys.colorpicker";
_emptyMessage = new CommandItem()
{
Icon = new IconInfo("\uE790"),
Title = "No colors found",
Subtitle = SearchText,
};
EmptyContent = _emptyMessage;
}
public override void UpdateSearchText(string oldSearch, string newSearch)
{
_emptyMessage.Subtitle = newSearch;
RaiseItemsChanged(0);
return;
}
public override IListItem[] GetItems() => ColorPickerHelper.GetColorItems(SearchText);
}

View File

@@ -1,38 +0,0 @@
// Copyright (c) Microsoft Corporation
// The Microsoft Corporation licenses this file to you under the MIT license.
// See the LICENSE file in the project root for more information.
using Microsoft.CmdPal.Ext.PowerToys.Helper;
using Microsoft.CmdPal.Ext.PowerToys.Properties;
using Microsoft.CommandPalette.Extensions;
using Microsoft.CommandPalette.Extensions.Toolkit;
namespace Microsoft.CmdPal.Ext.PowerToys.Pages;
internal sealed partial class PowerToysListPage : DynamicListPage
{
private readonly CommandItem _emptyMessage;
public PowerToysListPage()
{
Icon = IconHelpers.FromRelativePath("Assets\\PowerToys.svg");
Name = Title = Resources.PowerToysPage_Title;
Id = "com.microsoft.cmdpal.powertoys";
_emptyMessage = new CommandItem()
{
Icon = IconHelpers.FromRelativePath("Assets\\PowerToys.svg"),
Title = Resources.PowerToysPage_NotFoundModule,
Subtitle = SearchText,
};
EmptyContent = _emptyMessage;
}
public override void UpdateSearchText(string oldSearch, string newSearch)
{
_emptyMessage.Subtitle = newSearch;
RaiseItemsChanged(0);
return;
}
public override IListItem[] GetItems() => ModuleItemsHelper.FilteredItems(SearchText);
}

View File

@@ -1,37 +0,0 @@
// Copyright (c) Microsoft Corporation
// The Microsoft Corporation licenses this file to you under the MIT license.
// See the LICENSE file in the project root for more information.
using Microsoft.CmdPal.Ext.PowerToys.Helper;
using Microsoft.CommandPalette.Extensions;
using Microsoft.CommandPalette.Extensions.Toolkit;
namespace Microsoft.CmdPal.Ext.PowerToys.Pages;
internal sealed partial class WorkspacesListPage : DynamicListPage
{
private readonly CommandItem _emptyMessage;
public WorkspacesListPage()
{
Icon = IconHelpers.FromRelativePath("Assets\\Workspaces.png");
Name = Title = "Workspaces";
Id = "com.microsoft.cmdpal.powertoys.workspaces";
_emptyMessage = new CommandItem()
{
Icon = IconHelpers.FromRelativePath("Assets\\Workspaces.png"),
Title = "No workspaces found",
Subtitle = SearchText,
};
EmptyContent = _emptyMessage;
}
public override void UpdateSearchText(string oldSearch, string newSearch)
{
_emptyMessage.Subtitle = newSearch;
RaiseItemsChanged(0);
return;
}
public override IListItem[] GetItems() => WorkspaceItemsHelper.FilteredItems(SearchText);
}

View File

@@ -1,32 +0,0 @@
// Copyright (c) Microsoft Corporation
// The Microsoft Corporation licenses this file to you under the MIT license.
// See the LICENSE file in the project root for more information.
using Microsoft.CmdPal.Ext.PowerToys.Helper;
using Microsoft.CmdPal.Ext.PowerToys.Pages;
using Microsoft.CmdPal.Ext.PowerToys.Properties;
using Microsoft.CommandPalette.Extensions;
using Microsoft.CommandPalette.Extensions.Toolkit;
namespace Microsoft.CmdPal.Ext.PowerToys;
public partial class PowerToysCommandsProvider : CommandProvider
{
public PowerToysCommandsProvider()
{
Id = "Microsoft.PowerToys";
DisplayName = Resources.PowerToysProvider_DisplayName;
Icon = PowerToysResourcesHelper.ProviderIcon();
}
public override ICommandItem[] TopLevelCommands()
{
return [
new CommandItem(new PowerToysListPage())
{
Title = Resources.PowerToysPage_Title,
Subtitle = Resources.PowerToysPage_Subtitle,
}
];
}
}

View File

@@ -1,135 +0,0 @@
//------------------------------------------------------------------------------
// <auto-generated>
// This code was generated by a tool.
// Runtime Version:4.0.30319.42000
//
// Changes to this file may cause incorrect behavior and will be lost if
// the code is regenerated.
// </auto-generated>
//------------------------------------------------------------------------------
namespace Microsoft.CmdPal.Ext.PowerToys.Host.Properties {
using System;
/// <summary>
/// A strongly-typed resource class, for looking up localized strings, etc.
/// </summary>
// This class was auto-generated by the StronglyTypedResourceBuilder
// class via a tool like ResGen or Visual Studio.
// To add or remove a member, edit your .ResX file then rerun ResGen
// with the /str option, or rebuild your VS project.
[global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Resources.Tools.StronglyTypedResourceBuilder", "17.0.0.0")]
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
[global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()]
internal class Resources {
private static global::System.Resources.ResourceManager resourceMan;
private static global::System.Globalization.CultureInfo resourceCulture;
[global::System.Diagnostics.CodeAnalysis.SuppressMessageAttribute("Microsoft.Performance", "CA1811:AvoidUncalledPrivateCode")]
internal Resources() {
}
/// <summary>
/// Returns the cached ResourceManager instance used by this class.
/// </summary>
[global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)]
internal static global::System.Resources.ResourceManager ResourceManager {
get {
if (object.ReferenceEquals(resourceMan, null)) {
global::System.Resources.ResourceManager temp = new global::System.Resources.ResourceManager("Microsoft.CmdPal.Ext.PowerToys.Host.Properties.Resources", typeof(Resources).Assembly);
resourceMan = temp;
}
return resourceMan;
}
}
/// <summary>
/// Overrides the current thread's CurrentUICulture property for all
/// resource lookups using this strongly typed resource class.
/// </summary>
[global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)]
internal static global::System.Globalization.CultureInfo Culture {
get {
return resourceCulture;
}
set {
resourceCulture = value;
}
}
/// <summary>
/// Looks up a localized string similar to Launch.
/// </summary>
internal static string Launch_CommandName {
get {
return ResourceManager.GetString("Launch_CommandName", resourceCulture);
}
}
/// <summary>
/// Looks up a localized string similar to Open in Settings.
/// </summary>
internal static string OpenInSettings_CommandName {
get {
return ResourceManager.GetString("OpenInSettings_CommandName", resourceCulture);
}
}
/// <summary>
/// Looks up a localized string similar to Can&apos;t find specific module.
/// </summary>
internal static string PowerToysPage_NotFoundModule {
get {
return ResourceManager.GetString("PowerToysPage_NotFoundModule", resourceCulture);
}
}
/// <summary>
/// Looks up a localized string similar to Navigate through powertoys modules.
/// </summary>
internal static string PowerToysPage_Subtitle {
get {
return ResourceManager.GetString("PowerToysPage_Subtitle", resourceCulture);
}
}
/// <summary>
/// Looks up a localized string similar to PowerToys Modules.
/// </summary>
internal static string PowerToysPage_Title {
get {
return ResourceManager.GetString("PowerToysPage_Title", resourceCulture);
}
}
/// <summary>
/// Looks up a localized string similar to PowerToys.
/// </summary>
internal static string PowerToysProvider_DisplayName {
get {
return ResourceManager.GetString("PowerToysProvider_DisplayName", resourceCulture);
}
}
/// <summary>
/// Looks up a localized string similar to Workspaces not found.
/// </summary>
internal static string Workspace_NotFound_Message {
get {
return ResourceManager.GetString("Workspace_NotFound_Message", resourceCulture);
}
}
/// <summary>
/// Looks up a localized string similar to Workspaces.
/// </summary>
internal static string WorkspacesPage_Title {
get {
return ResourceManager.GetString("WorkspacesPage_Title", resourceCulture);
}
}
}
}

View File

@@ -1,144 +0,0 @@
<?xml version="1.0" encoding="utf-8"?>
<root>
<!--
Microsoft ResX Schema
Version 2.0
The primary goals of this format is to allow a simple XML format
that is mostly human readable. The generation and parsing of the
various data types are done through the TypeConverter classes
associated with the data types.
Example:
... ado.net/XML headers & schema ...
<resheader name="resmimetype">text/microsoft-resx</resheader>
<resheader name="version">2.0</resheader>
<resheader name="reader">System.Resources.ResXResourceReader, System.Windows.Forms, ...</resheader>
<resheader name="writer">System.Resources.ResXResourceWriter, System.Windows.Forms, ...</resheader>
<data name="Name1"><value>this is my long string</value><comment>this is a comment</comment></data>
<data name="Color1" type="System.Drawing.Color, System.Drawing">Blue</data>
<data name="Bitmap1" mimetype="application/x-microsoft.net.object.binary.base64">
<value>[base64 mime encoded serialized .NET Framework object]</value>
</data>
<data name="Icon1" type="System.Drawing.Icon, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
<value>[base64 mime encoded string representing a byte array form of the .NET Framework object]</value>
<comment>This is a comment</comment>
</data>
There are any number of "resheader" rows that contain simple
name/value pairs.
Each data row contains a name, and value. The row also contains a
type or mimetype. Type corresponds to a .NET class that support
text/value conversion through the TypeConverter architecture.
Classes that don't support this are serialized and stored with the
mimetype set.
The mimetype is used for serialized objects, and tells the
ResXResourceReader how to depersist the object. This is currently not
extensible. For a given mimetype the value must be set accordingly:
Note - application/x-microsoft.net.object.binary.base64 is the format
that the ResXResourceWriter will generate, however the reader can
read any of the formats listed below.
mimetype: application/x-microsoft.net.object.binary.base64
value : The object must be serialized with
: System.Runtime.Serialization.Formatters.Binary.BinaryFormatter
: and then encoded with base64 encoding.
mimetype: application/x-microsoft.net.object.soap.base64
value : The object must be serialized with
: System.Runtime.Serialization.Formatters.Soap.SoapFormatter
: and then encoded with base64 encoding.
mimetype: application/x-microsoft.net.object.bytearray.base64
value : The object must be serialized into a byte array
: using a System.ComponentModel.TypeConverter
: and then encoded with base64 encoding.
-->
<xsd:schema id="root" xmlns="" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata">
<xsd:import namespace="http://www.w3.org/XML/1998/namespace" />
<xsd:element name="root" msdata:IsDataSet="true">
<xsd:complexType>
<xsd:choice maxOccurs="unbounded">
<xsd:element name="metadata">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" />
</xsd:sequence>
<xsd:attribute name="name" use="required" type="xsd:string" />
<xsd:attribute name="type" type="xsd:string" />
<xsd:attribute name="mimetype" type="xsd:string" />
<xsd:attribute ref="xml:space" />
</xsd:complexType>
</xsd:element>
<xsd:element name="assembly">
<xsd:complexType>
<xsd:attribute name="alias" type="xsd:string" />
<xsd:attribute name="name" type="xsd:string" />
</xsd:complexType>
</xsd:element>
<xsd:element name="data">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
<xsd:element name="comment" type="xsd:string" minOccurs="0" msdata:Ordinal="2" />
</xsd:sequence>
<xsd:attribute name="name" type="xsd:string" use="required" msdata:Ordinal="1" />
<xsd:attribute name="type" type="xsd:string" msdata:Ordinal="3" />
<xsd:attribute name="mimetype" type="xsd:string" msdata:Ordinal="4" />
<xsd:attribute ref="xml:space" />
</xsd:complexType>
</xsd:element>
<xsd:element name="resheader">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
</xsd:sequence>
<xsd:attribute name="name" type="xsd:string" use="required" />
</xsd:complexType>
</xsd:element>
</xsd:choice>
</xsd:complexType>
</xsd:element>
</xsd:schema>
<resheader name="resmimetype">
<value>text/microsoft-resx</value>
</resheader>
<resheader name="version">
<value>2.0</value>
</resheader>
<resheader name="reader">
<value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
<resheader name="writer">
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
<data name="OpenInSettings_CommandName" xml:space="preserve">
<value>Open in Settings</value>
</data>
<data name="PowerToysPage_Title" xml:space="preserve">
<value>PowerToys Modules</value>
</data>
<data name="PowerToysPage_Subtitle" xml:space="preserve">
<value>Navigate through powertoys modules</value>
</data>
<data name="PowerToysProvider_DisplayName" xml:space="preserve">
<value>PowerToys</value>
</data>
<data name="PowerToysPage_NotFoundModule" xml:space="preserve">
<value>Can't find specific module</value>
</data>
<data name="Launch_CommandName" xml:space="preserve">
<value>Launch</value>
</data>
<data name="WorkspacesPage_Title" xml:space="preserve">
<value>Workspaces</value>
</data>
<data name="Workspace_NotFound_Message" xml:space="preserve">
<value>Workspaces not found</value>
</data>
</root>

View File

@@ -1,29 +0,0 @@
| ModuleName | Command/Feature (implemented) |
|---|---|
| Color Picker | Open in Settings; Launch Color Picker; Saved colors list; Copy color |
| Crop And Lock | Open in Settings; Crop and Lock (Thumbnail); Crop and Lock (Reparent) |
| Workspaces | Workspaces list page; Launch workspace; Open in Settings; Launch editor |
| FancyZones | Open in Settings; Launch (toggle editor) |
| Hosts File Editor | Open in Settings; Launch |
| Screen Ruler | Open in Settings; Launch |
| Text Extractor | Open in Settings; Launch |
| Shortcut Guide | Open in Settings; Launch |
| Registry Preview | Open in Settings; Launch |
| Environment Variables | Open in Settings; Launch |
| PowerToys Run | Open in Settings |
| Image Resizer | Open in Settings |
| Keyboard Manager | Open in Settings |
| Mouse Utilities | Open in Settings |
| PowerRename | Open in Settings |
| File Explorer Add-ons | Open in Settings |
| Advanced Paste | Open in Settings |
| Command Palette | Open in Settings |
| ZoomIt | Open in Settings |
| Always On Top | Open in Settings |
| File Locksmith | Open in Settings |
| New+ | Open in Settings |
| Peek | Open in Settings |
| Command Not Found | Open in Settings |
| Mouse Without Borders | Open in Settings |
| Quick Accent | Open in Settings |
| PowerToys Run (alias) | Open in Settings |

View File

@@ -1,81 +0,0 @@
<?xml version="1.0" encoding="utf-8"?>
<Package
xmlns="http://schemas.microsoft.com/appx/manifest/foundation/windows10"
xmlns:uap="http://schemas.microsoft.com/appx/manifest/uap/windows10"
xmlns:uap3="http://schemas.microsoft.com/appx/manifest/uap/windows10/3"
xmlns:com="http://schemas.microsoft.com/appx/manifest/com/windows10"
xmlns:rescap="http://schemas.microsoft.com/appx/manifest/foundation/windows10/restrictedcapabilities"
IgnorableNamespaces="uap uap3 rescap">
<Identity
Name="PowerToysCommandPaletteExtension"
Publisher="CN=Microsoft Corporation, O=Microsoft Corporation, L=Redmond, S=Washington, C=US"
Version="0.0.1.0" />
<Properties>
<DisplayName>PowerToys Command Palette Extension</DisplayName>
<PublisherDisplayName>Microsoft Corporation</PublisherDisplayName>
<Logo>Assets\StoreLogo.scale-200.png</Logo>
</Properties>
<Dependencies>
<TargetDeviceFamily Name="Windows.Universal" MinVersion="10.0.19041.0" MaxVersionTested="10.0.19041.0" />
<TargetDeviceFamily Name="Windows.Desktop" MinVersion="10.0.19041.0" MaxVersionTested="10.0.19041.0" />
</Dependencies>
<Resources>
<Resource Language="x-generate" />
</Resources>
<Applications>
<Application Id="App"
Executable="$targetnametoken$.exe"
EntryPoint="$targetentrypoint$">
<uap:VisualElements
DisplayName="PowerToys Command Palette Extension"
Description="Surface PowerToys modules and actions in Command Palette."
BackgroundColor="transparent"
Square150x150Logo="Assets\Square150x150Logo.scale-200.png"
Square44x44Logo="Assets\Square44x44Logo.scale-200.png">
<uap:DefaultTile Wide310x150Logo="Assets\Wide310x150Logo.scale-200.png" />
<uap:SplashScreen Image="Assets\SplashScreen.scale-200.png" />
</uap:VisualElements>
<Extensions>
<com:Extension Category="windows.comServer">
<com:ComServer>
<com:ExeServer Executable="PowerToysCommandPaletteExtension.exe"
Arguments="-RegisterProcessAsComServer"
DisplayName="PowerToys Command Palette Extension">
<com:Class Id="F0A8B809-CE2C-475A-935F-64A0348B1D29" DisplayName="PowerToys Command Palette Extension" />
</com:ExeServer>
</com:ComServer>
</com:Extension>
<uap3:Extension Category="windows.appExtension">
<uap3:AppExtension Name="com.microsoft.commandpalette"
Id="PowerToys"
PublicFolder="Public"
DisplayName="PowerToys"
Description="Expose PowerToys commands to Command Palette.">
<uap3:Properties>
<CmdPalProvider xmlns="http://schemas.microsoft.com/commandpalette/2024/extension">
<Metadata DisplayName="PowerToys" Description="Built-in PowerToys commands." />
<Activation>
<CreateInstance ClassId="F0A8B809-CE2C-475A-935F-64A0348B1D29" />
</Activation>
<SupportedInterfaces>
<Commands />
</SupportedInterfaces>
</CmdPalProvider>
</uap3:Properties>
</uap3:AppExtension>
</uap3:Extension>
</Extensions>
</Application>
</Applications>
<Capabilities>
<Capability Name="internetClient" />
<rescap:Capability Name="runFullTrust" />
</Capabilities>
</Package>

View File

@@ -1,87 +0,0 @@
<Project Sdk="Microsoft.NET.Sdk">
<Import Project="..\..\..\..\Common.Dotnet.CsWinRT.props" />
<Import Project="..\..\..\..\Common.Dotnet.AotCompatibility.props" />
<PropertyGroup>
<OutputType>WinExe</OutputType>
<RootNamespace>PowerToysCommandPaletteExtension</RootNamespace>
<ApplicationManifest>app.manifest</ApplicationManifest>
<PublishProfile>win-$(Platform).pubxml</PublishProfile>
<UseWinUI>false</UseWinUI>
<EnableMsixTooling>true</EnableMsixTooling>
<GenerateAppxPackageOnBuild>true</GenerateAppxPackageOnBuild>
<OutputPath>$(SolutionDir)$(Platform)\$(Configuration)\WinUI3Apps\CmdPalExtensions\$(MSBuildProjectName)\</OutputPath>
<AppendTargetFrameworkToOutputPath>false</AppendTargetFrameworkToOutputPath>
<AppendRuntimeIdentifierToOutputPath>false</AppendRuntimeIdentifierToOutputPath>
<Nullable>enable</Nullable>
</PropertyGroup>
<ItemGroup>
<Manifest Include="$(ApplicationManifest)" />
</ItemGroup>
<ItemGroup>
<Content Include="..\Microsoft.CmdPal.UI\Assets\Stable\SplashScreen.scale-200.png">
<Link>Assets\SplashScreen.scale-200.png</Link>
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</Content>
<Content Include="..\Microsoft.CmdPal.UI\Assets\Stable\LockScreenLogo.scale-200.png">
<Link>Assets\LockScreenLogo.scale-200.png</Link>
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</Content>
<Content Include="..\Microsoft.CmdPal.UI\Assets\Stable\Square150x150Logo.scale-200.png">
<Link>Assets\Square150x150Logo.scale-200.png</Link>
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</Content>
<Content Include="..\Microsoft.CmdPal.UI\Assets\Stable\Square44x44Logo.scale-200.png">
<Link>Assets\Square44x44Logo.scale-200.png</Link>
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</Content>
<Content Include="..\Microsoft.CmdPal.UI\Assets\Stable\Square44x44Logo.targetsize-24_altform-unplated.png">
<Link>Assets\Square44x44Logo.targetsize-24_altform-unplated.png</Link>
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</Content>
<Content Include="..\Microsoft.CmdPal.UI\Assets\Stable\StoreLogo.scale-200.png">
<Link>Assets\StoreLogo.scale-200.png</Link>
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</Content>
<Content Include="..\Microsoft.CmdPal.UI\Assets\Stable\Wide310x150Logo.scale-200.png">
<Link>Assets\Wide310x150Logo.scale-200.png</Link>
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</Content>
<None Include="Public\README.md">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</None>
</ItemGroup>
<ItemGroup>
<ProjectReference Include="..\Microsoft.CmdPal.Ext.PowerToys.Host\Microsoft.CmdPal.Ext.PowerToys.Host.csproj" />
<ProjectReference Include="..\..\extensionsdk\Microsoft.CommandPalette.Extensions.Toolkit\Microsoft.CommandPalette.Extensions.Toolkit.csproj" />
</ItemGroup> <ItemGroup>
<PackageReference Include="Microsoft.WindowsAppSDK" />
<PackageReference Include="Microsoft.Windows.CsWin32">
<PrivateAssets>all</PrivateAssets>
<IncludeAssets>runtime; build; native; contentfiles; analyzers</IncludeAssets>
</PackageReference>
</ItemGroup>
<ItemGroup Condition="'$(DisableMsixProjectCapabilityAddedByProject)'!='true' and '$(EnableMsixTooling)'=='true'">
<ProjectCapability Include="Msix" />
</ItemGroup>
<PropertyGroup Condition="'$(DisableHasPackageAndPublishMenuAddedByProject)'!='true' and '$(EnableMsixTooling)'=='true'">
<HasPackageAndPublishMenu>true</HasPackageAndPublishMenu>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)' == 'Release'">
<PublishTrimmed>true</PublishTrimmed>
<PublishSingleFile>true</PublishSingleFile>
<PublishAot>true</PublishAot>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)' == 'Debug'">
<PublishTrimmed>false</PublishTrimmed>
<PublishSingleFile>false</PublishSingleFile>
<PublishAot>false</PublishAot>
</PropertyGroup>
</Project>

View File

@@ -1,39 +0,0 @@
// Copyright (c) Microsoft Corporation
// The Microsoft Corporation licenses this file to you under the MIT license.
// See the LICENSE file in the project root for more information.
using System;
using System.Runtime.InteropServices;
using System.Threading;
using Microsoft.CmdPal.Ext.PowerToys.Host;
using Microsoft.CommandPalette.Extensions;
namespace PowerToysCommandPaletteExtension;
[ComVisible(true)]
[Guid("F0A8B809-CE2C-475A-935F-64A0348B1D29")]
[ComDefaultInterface(typeof(IExtension))]
public sealed class PowerToysExtension : IExtension, IDisposable
{
private readonly ManualResetEvent _lifetime;
private readonly PowerToysCommandsProvider _provider = new();
public PowerToysExtension(ManualResetEvent extensionDisposedEvent)
{
_lifetime = extensionDisposedEvent;
}
public object? GetProvider(ProviderType providerType)
{
return providerType switch
{
ProviderType.Commands => _provider,
_ => null,
};
}
public void Dispose()
{
_lifetime.Set();
}
}

View File

@@ -1,31 +0,0 @@
// Copyright (c) Microsoft Corporation
// The Microsoft Corporation licenses this file to you under the MIT license.
// See the LICENSE file in the project root for more information.
using System;
using System.Threading;
using Microsoft.CommandPalette.Extensions;
namespace PowerToysCommandPaletteExtension;
public static class Program
{
[MTAThread]
public static int Main(string[] args)
{
if (args.Length > 0 && args[0].Equals("-RegisterProcessAsComServer", StringComparison.OrdinalIgnoreCase))
{
using ExtensionServer server = new();
using ManualResetEvent extensionDisposed = new(false);
var extensionInstance = new PowerToysExtension(extensionDisposed);
server.RegisterExtension(() => extensionInstance);
extensionDisposed.WaitOne();
return 0;
}
Console.WriteLine("PowerToysCommandPaletteExtension launched without COM registration arguments. Exiting.");
return 0;
}
}