forked from microsoft/PowerToys
-
Notifications
You must be signed in to change notification settings - Fork 9
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
84a6432
commit 928a0b0
Showing
29 changed files
with
394 additions
and
49 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
9 changes: 9 additions & 0 deletions
9
...les/cmdpal/ExtensionTemplate/TemplateCmdPalExtension/Common.Dotnet.AotCompatibility.props
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
<?xml version="1.0" encoding="utf-8"?> | ||
<!-- Some items may be set in Directory.Build.props in root --> | ||
<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003"> | ||
<PropertyGroup> | ||
<IsAotCompatible>true</IsAotCompatible> | ||
<CsWinRTAotOptimizerEnabled>true</CsWinRTAotOptimizerEnabled> | ||
<CsWinRTAotWarningLevel>2</CsWinRTAotWarningLevel> | ||
</PropertyGroup> | ||
</Project> |
15 changes: 15 additions & 0 deletions
15
src/modules/cmdpal/ExtensionTemplate/TemplateCmdPalExtension/Directory.Packages.props
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
<Project> | ||
<PropertyGroup> | ||
<ManagePackageVersionsCentrally>true</ManagePackageVersionsCentrally> | ||
</PropertyGroup> | ||
<ItemGroup> | ||
<PackageVersion Include="Microsoft.CmdPal.Extensions.SDK" Version="0.0.4" /> | ||
<PackageVersion Include="Microsoft.CodeAnalysis.NetAnalyzers" Version="9.0.0-preview.24508.2" /> | ||
<PackageVersion Include="Microsoft.Web.WebView2" Version="1.0.2903.40" /> | ||
<PackageVersion Include="Microsoft.Windows.CsWin32" Version="0.2.46-beta" /> | ||
<PackageVersion Include="Microsoft.Windows.CsWinRT" Version="2.1.5" /> | ||
<PackageVersion Include="Microsoft.Windows.SDK.BuildTools" Version="10.0.22621.2428" /> | ||
<PackageVersion Include="Microsoft.WindowsAppSDK" Version="1.6.241114003" /> | ||
<PackageVersion Include="StyleCop.Analyzers" Version="1.2.0-beta.556" /> | ||
</ItemGroup> | ||
</Project> |
43 changes: 43 additions & 0 deletions
43
src/modules/cmdpal/ExtensionTemplate/TemplateCmdPalExtension/TemplateCmdPalExtension.sln
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,43 @@ | ||
|
||
Microsoft Visual Studio Solution File, Format Version 12.00 | ||
# Visual Studio Version 17 | ||
VisualStudioVersion = 17.13.35507.96 d17.13 | ||
MinimumVisualStudioVersion = 10.0.40219.1 | ||
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "TemplateCmdPalExtension", "TemplateCmdPalExtension\TemplateCmdPalExtension.csproj", "{79F86DE5-70B1-4EC1-9832-DF428B55E466}" | ||
EndProject | ||
Global | ||
GlobalSection(SolutionConfigurationPlatforms) = preSolution | ||
Debug|ARM64 = Debug|ARM64 | ||
Debug|x64 = Debug|x64 | ||
Debug|x86 = Debug|x86 | ||
Release|ARM64 = Release|ARM64 | ||
Release|x64 = Release|x64 | ||
Release|x86 = Release|x86 | ||
EndGlobalSection | ||
GlobalSection(ProjectConfigurationPlatforms) = postSolution | ||
{79F86DE5-70B1-4EC1-9832-DF428B55E466}.Debug|ARM64.ActiveCfg = Debug|ARM64 | ||
{79F86DE5-70B1-4EC1-9832-DF428B55E466}.Debug|ARM64.Build.0 = Debug|ARM64 | ||
{79F86DE5-70B1-4EC1-9832-DF428B55E466}.Debug|ARM64.Deploy.0 = Debug|ARM64 | ||
{79F86DE5-70B1-4EC1-9832-DF428B55E466}.Debug|x64.ActiveCfg = Debug|x64 | ||
{79F86DE5-70B1-4EC1-9832-DF428B55E466}.Debug|x64.Build.0 = Debug|x64 | ||
{79F86DE5-70B1-4EC1-9832-DF428B55E466}.Debug|x64.Deploy.0 = Debug|x64 | ||
{79F86DE5-70B1-4EC1-9832-DF428B55E466}.Debug|x86.ActiveCfg = Debug|x86 | ||
{79F86DE5-70B1-4EC1-9832-DF428B55E466}.Debug|x86.Build.0 = Debug|x86 | ||
{79F86DE5-70B1-4EC1-9832-DF428B55E466}.Debug|x86.Deploy.0 = Debug|x86 | ||
{79F86DE5-70B1-4EC1-9832-DF428B55E466}.Release|ARM64.ActiveCfg = Release|ARM64 | ||
{79F86DE5-70B1-4EC1-9832-DF428B55E466}.Release|ARM64.Build.0 = Release|ARM64 | ||
{79F86DE5-70B1-4EC1-9832-DF428B55E466}.Release|ARM64.Deploy.0 = Release|ARM64 | ||
{79F86DE5-70B1-4EC1-9832-DF428B55E466}.Release|x64.ActiveCfg = Release|x64 | ||
{79F86DE5-70B1-4EC1-9832-DF428B55E466}.Release|x64.Build.0 = Release|x64 | ||
{79F86DE5-70B1-4EC1-9832-DF428B55E466}.Release|x64.Deploy.0 = Release|x64 | ||
{79F86DE5-70B1-4EC1-9832-DF428B55E466}.Release|x86.ActiveCfg = Release|x86 | ||
{79F86DE5-70B1-4EC1-9832-DF428B55E466}.Release|x86.Build.0 = Release|x86 | ||
{79F86DE5-70B1-4EC1-9832-DF428B55E466}.Release|x86.Deploy.0 = Release|x86 | ||
EndGlobalSection | ||
GlobalSection(SolutionProperties) = preSolution | ||
HideSolutionNode = FALSE | ||
EndGlobalSection | ||
GlobalSection(ExtensibilityGlobals) = postSolution | ||
SolutionGuid = {CEDBC581-5818-4350-BC8A-A1ECE687D357} | ||
EndGlobalSection | ||
EndGlobal |
Binary file added
BIN
+432 Bytes
...lateCmdPalExtension/TemplateCmdPalExtension/Assets/LockScreenLogo.scale-200.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added
BIN
+5.25 KB
...mplateCmdPalExtension/TemplateCmdPalExtension/Assets/SplashScreen.scale-200.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added
BIN
+1.71 KB
...eCmdPalExtension/TemplateCmdPalExtension/Assets/Square150x150Logo.scale-200.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added
BIN
+637 Bytes
...ateCmdPalExtension/TemplateCmdPalExtension/Assets/Square44x44Logo.scale-200.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added
BIN
+283 Bytes
...mplateCmdPalExtension/Assets/Square44x44Logo.targetsize-24_altform-unplated.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added
BIN
+456 Bytes
...onTemplate/TemplateCmdPalExtension/TemplateCmdPalExtension/Assets/StoreLogo.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added
BIN
+2.05 KB
...ateCmdPalExtension/TemplateCmdPalExtension/Assets/Wide310x150Logo.scale-200.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
78 changes: 78 additions & 0 deletions
78
...al/ExtensionTemplate/TemplateCmdPalExtension/TemplateCmdPalExtension/Package.appxmanifest
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,78 @@ | ||
<?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="TemplateCmdPalExtension" | ||
Publisher="CN=Microsoft Corporation, O=Microsoft Corporation, L=Redmond, S=Washington, C=US" | ||
Version="0.0.1.0" /> | ||
|
||
<Properties> | ||
<DisplayName>TemplateDisplayName</DisplayName> | ||
<PublisherDisplayName>A Lone Developer</PublisherDisplayName> | ||
<Logo>Assets\StoreLogo.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="TemplateDisplayName" | ||
Description="TemplateDisplayName" | ||
BackgroundColor="transparent" | ||
Square150x150Logo="Assets\Square150x150Logo.png" | ||
Square44x44Logo="Assets\Square44x44Logo.png"> | ||
<uap:DefaultTile Wide310x150Logo="Assets\Wide310x150Logo.png" /> | ||
<uap:SplashScreen Image="Assets\SplashScreen.png" /> | ||
</uap:VisualElements> | ||
<Extensions> | ||
<com:Extension Category="windows.comServer"> | ||
<com:ComServer> | ||
<com:ExeServer Executable="TemplateCmdPalExtension.exe" Arguments="-RegisterProcessAsComServer" DisplayName="TemplateDisplayName"> | ||
<com:Class Id="FFFFFFFF-FFFF-FFFF-FFFF-FFFFFFFFFFFF" DisplayName="TemplateDisplayName" /> | ||
</com:ExeServer> | ||
</com:ComServer> | ||
</com:Extension> | ||
<uap3:Extension Category="windows.appExtension"> | ||
<uap3:AppExtension Name="com.microsoft.windows.commandpalette" | ||
Id="PG-SP-ID" | ||
PublicFolder="Public" | ||
DisplayName="TemplateDisplayName" | ||
Description="TemplateDisplayName"> | ||
<uap3:Properties> | ||
<CmdPalProvider> | ||
<Activation> | ||
<CreateInstance ClassId="FFFFFFFF-FFFF-FFFF-FFFF-FFFFFFFFFFFF" /> | ||
</Activation> | ||
<SupportedInterfaces> | ||
<Commands/> | ||
</SupportedInterfaces> | ||
</CmdPalProvider> | ||
</uap3:Properties> | ||
</uap3:AppExtension> | ||
</uap3:Extension> | ||
</Extensions> | ||
</Application> | ||
</Applications> | ||
|
||
<Capabilities> | ||
<Capability Name="internetClient" /> | ||
<rescap:Capability Name="runFullTrust" /> | ||
</Capabilities> | ||
</Package> |
25 changes: 25 additions & 0 deletions
25
...onTemplate/TemplateCmdPalExtension/TemplateCmdPalExtension/Pages/TemplateExtensionPage.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
// 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.CmdPal.Extensions; | ||
using Microsoft.CmdPal.Extensions.Helpers; | ||
|
||
namespace TemplateCmdPalExtension; | ||
|
||
internal sealed partial class TemplateCmdPalExtensionPage : ListPage | ||
{ | ||
public TemplateCmdPalExtensionPage() | ||
{ | ||
Icon = new(string.Empty); | ||
Name = "TemplateDisplayName"; | ||
} | ||
|
||
public override IListItem[] GetItems() | ||
{ | ||
return [ | ||
new ListItem(new NoOpCommand()) { Title = "TODO: Implement your extension here" } | ||
]; | ||
} | ||
} |
36 changes: 36 additions & 0 deletions
36
...dules/cmdpal/ExtensionTemplate/TemplateCmdPalExtension/TemplateCmdPalExtension/Program.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
// 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.CmdPal.Extensions; | ||
|
||
namespace TemplateCmdPalExtension; | ||
|
||
public class Program | ||
{ | ||
[MTAThread] | ||
public static void Main(string[] args) | ||
{ | ||
if (args.Length > 0 && args[0] == "-RegisterProcessAsComServer") | ||
{ | ||
using ExtensionServer server = new(); | ||
var extensionDisposedEvent = new ManualResetEvent(false); | ||
var extensionInstance = new SampleExtension(extensionDisposedEvent); | ||
|
||
// We are instantiating an extension instance once above, and returning it every time the callback in RegisterExtension below is called. | ||
// This makes sure that only one instance of SampleExtension is alive, which is returned every time the host asks for the IExtension object. | ||
// If you want to instantiate a new instance each time the host asks, create the new instance inside the delegate. | ||
server.RegisterExtension(() => extensionInstance); | ||
|
||
// This will make the main thread wait until the event is signalled by the extension class. | ||
// Since we have single instance of the extension object, we exit as soon as it is disposed. | ||
extensionDisposedEvent.WaitOne(); | ||
} | ||
else | ||
{ | ||
Console.WriteLine("Not being launched as a Extension... exiting."); | ||
} | ||
} | ||
} |
36 changes: 36 additions & 0 deletions
36
...dpal/ExtensionTemplate/TemplateCmdPalExtension/TemplateCmdPalExtension/SampleExtension.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
// 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.Extensions; | ||
|
||
namespace TemplateCmdPalExtension; | ||
|
||
[ComVisible(true)] | ||
[Guid("FFFFFFFF-FFFF-FFFF-FFFF-FFFFFFFFFFFF")] | ||
[ComDefaultInterface(typeof(IExtension))] | ||
public sealed partial class SampleExtension : IExtension, IDisposable | ||
{ | ||
private readonly ManualResetEvent _extensionDisposedEvent; | ||
|
||
private readonly TemplateCmdPalExtensionActionsProvider _provider = new(); | ||
|
||
public SampleExtension(ManualResetEvent extensionDisposedEvent) | ||
{ | ||
this._extensionDisposedEvent = extensionDisposedEvent; | ||
} | ||
|
||
public object? GetProvider(ProviderType providerType) | ||
{ | ||
return providerType switch | ||
{ | ||
ProviderType.Commands => _provider, | ||
_ => null, | ||
}; | ||
} | ||
|
||
public void Dispose() => this._extensionDisposedEvent.Set(); | ||
} |
Oops, something went wrong.