-
Notifications
You must be signed in to change notification settings - Fork 7.2k
Added basic support for Windows App Actions. #39927
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please do not add new PInvoke call in cmdpal. We are trying to make it become native aot.
src/modules/cmdpal/ext/Microsoft.CmdPal.Ext.Indexer/Actions/ActionRuntimeFactory.cs
Outdated
Show resolved
Hide resolved
src/modules/cmdpal/ext/Microsoft.CmdPal.Ext.Indexer/NativeMethods.txt
Outdated
Show resolved
Hide resolved
I'm not sure if it's suitable for indexer extension. I guess we need to create a new ext for it? At least, I think we need to add a new setting to control this behaviour. any idea? |
This comment has been minimized.
This comment has been minimized.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull Request Overview
This PR adds basic support for Windows App Actions by updating Windows SDK and related package versions while introducing new actions handling commands into the Command Palette.
- Update package versions and Windows SDK target versions
- Introduce ActionsListContextItem along with supporting commands and runtime for handling app actions
- Update project configuration files and resource definitions to support new actions
Reviewed Changes
Copilot reviewed 20 out of 21 changed files in this pull request and generated 3 comments.
Show a summary per file
File | Description |
---|---|
packages.config | Updated Microsoft.Windows.SDK.BuildTools version to 10.0.26100.4188 |
Microsoft.CommandPalette.Extensions.vcxproj | Updated WindowsTargetPlatformVersion to 10.0.26100.0 |
Utilities.cs | Removed redundant cast from flag parameter |
DefaultBrowserInfo.cs | Updated SHLoadIndirectString call to use new syntax and pointer handling |
Resources.resx | Added new localized string for actions |
Icons.cs | Added new icon for actions support |
ActionsListContextItem.cs | Introduced new context item for listing available actions based on file type |
NativeMethods.json, NativeHelpers.cs | Updated COM related constants and settings |
IndexerListItem.cs | Modified MoreCommands to conditionally include the new actions context item |
ExecuteActionCommand.cs | Added new command for executing a selected Windows App Action |
ActionRuntimeFactory.cs | Added factory for creating an ActionRuntime instance |
UWPApplication.cs | Updated resource loading with updated SHLoadIndirectString usage |
Common.Dotnet.CsWinRT.props, Directory.Packages.props, Cpp.Build.props, .vsconfig | Revised SDK/package versions to align with new Windows SDK support |
Files not reviewed (1)
- src/modules/cmdpal/ext/Microsoft.CmdPal.Ext.Indexer/Properties/Resources.Designer.cs: Language not supported
== 0) | ||
{ | ||
return new string(buffer); | ||
default) == 0) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It appears there is an extra closing parenthesis when passing 'default' as the fourth argument to SHLoadIndirectString; please review and adjust the parameter parentheses so that the method call compiles correctly.
Copilot uses AI. Check for mistakes.
internal sealed partial class ActionsListContextItem : CommandContextItem | ||
{ | ||
private readonly string fullPath; | ||
private readonly List<CommandContextItem> actions = []; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The empty list initializer using '[]' is not a standard way to initialize a List in C#; consider using 'new List()' instead.
private readonly List<CommandContextItem> actions = []; | |
private readonly List<CommandContextItem> actions = new List<CommandContextItem>(); |
Copilot uses AI. Check for mistakes.
src/modules/cmdpal/ext/Microsoft.CmdPal.Ext.Indexer/Commands/ExecuteActionCommand.cs
Show resolved
Hide resolved
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@azchohfi, can you show some screenshot as well as part of the PR description?
Looks like we support 3 experiences now:
a. Photos (hardcode extension list)
b. Docs (hardcode extension list)
c. Normal Files (any others)
@cinnamon-msft and @niels9001, please review the experience.
@@ -4,8 +4,8 @@ | |||
<Import Project=".\Common.Dotnet.PrepareGeneratedFolder.targets" /> | |||
|
|||
<PropertyGroup> | |||
<WindowsSdkPackageVersion>10.0.22621.57</WindowsSdkPackageVersion> | |||
<TargetFramework>net9.0-windows10.0.22621.0</TargetFramework> | |||
<WindowsSdkPackageVersion>10.0.26100.68-preview</WindowsSdkPackageVersion> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thus, it is not only Win11, but even need more advanced version?
Given Powertoys support from Win10 to Win11, asking this to see what experience it can be.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks like since we specified SupportedOSPlatformVersion, during build time will tell us as warning if we access any API only support in higher version of OS.
I don't see warning about API usage like CA1416;CS8776, we should be good.
src/modules/cmdpal/ext/Microsoft.CmdPal.Ext.Indexer/Data/IndexerListItem.cs
Show resolved
Hide resolved
(admittedly, I had to make a small change to support this - I had to change -this.Name = actionInstance.DisplayInfo.Description
+this.Name = actionInstance.Definition.Description in We have other Big Ideas here with Actions and Command Palette (which I'll probably start working on more again in July when I'm back) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm like mostly okay with this. Couple nits - I didn't read the code too carefully. But it's cool, that's for sure.
Updating the SDK version is always scary (Terminal's hit some breaking changes in the past with SDK updates 🙃) but What Could Go Wrong?
Hopefully we'll see more than just a couple actions showing up in here soon 😉
@@ -9,6 +9,7 @@ | |||
"Microsoft.VisualStudio.Component.Windows10SDK.19041", | |||
"Microsoft.VisualStudio.Component.Windows10SDK.20348", | |||
"Microsoft.VisualStudio.Component.Windows10SDK.22621", |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This isn't specific to this PR:
@crutkas have we been just adding new SDK versions to our .vsconfig
this whole time? Presumably we don't need all of them - only the latest, right? We can probably prune this down, yea?
src/modules/cmdpal/ext/Microsoft.CmdPal.Ext.Indexer/Pages/ActionsListContextItem.cs
Show resolved
Hide resolved
src/modules/cmdpal/ext/Microsoft.CmdPal.Ext.Indexer/Properties/Resources.resx
Outdated
Show resolved
Hide resolved
src/modules/cmdpal/ext/Microsoft.CmdPal.Ext.Indexer/Pages/ActionsListContextItem.cs
Outdated
Show resolved
Hide resolved
if (actionRuntime == null) | ||
{ | ||
actionRuntime = ActionRuntimeFactory.CreateActionRuntime(); | ||
Task.Delay(500).Wait(); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
this looks sus - why wait 500ms here?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is a bug we uncovered on the runtime last minute... It will be fixed, but its not yet, so if we don't add this, all instant calls to the runtime hung...
} | ||
|
||
actionRuntime.ActionCatalog.Changed -= ActionCatalog_Changed; | ||
actionRuntime.ActionCatalog.Changed += ActionCatalog_Changed; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
do we need to remove this event handler in our dtor?
(this is just me being mid at C# - I forget if these event handlers are smart and will get cleaned up for us or not)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is a good question, but I had no easy solution here. The actionRuntime is static, so we don't recreate it all the time, so this event subscription will keep a hold of the instance of ActionsListContextItem that holds the ActionCatalog_Changed instance method. There is no dctor here to be called, or any pattern actually that would suffice without adding something into the toolkit, since the object won't be disposed by the garbage collector. This object is passed down to the MoreItems property of the ListItem, and, AFAIK, there is no such concept of being dismissed or anything like that.
The reason we have this event handler to begin with is to handle the case where the user typed something, it returned a list of actions, but then something happens and the available actions change (multiple different things could have happened, like a user signed out of the account and they decided to make the action not available, or there is a quota and that quota is over, so it should not be available, or the user uninstalled, or installed, an app).
src/modules/cmdpal/ext/Microsoft.CmdPal.Ext.Indexer/Data/IndexerListItem.cs
Show resolved
Hide resolved
this.Icon = new IconInfo(actionInstance.Definition.IconFullPath); | ||
} | ||
|
||
public override CommandResult Invoke() |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
note to self: this is the canonical example of #38326
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes, please.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
From a PM stance I'm cool with this, looks like a nice toe-dip into Actions and I'm eager to see community feedback on it :) |
…/Resources.resx Co-authored-by: Mike Griese <migrie@microsoft.com>
af87ba3
to
d168ae5
Compare
This comment has been minimized.
This comment has been minimized.
/azp run |
Azure Pipelines successfully started running 1 pipeline(s). |
…zollin/actionsInvoke
/azp run |
Azure Pipelines successfully started running 1 pipeline(s). |
/azp run |
Azure Pipelines successfully started running 1 pipeline(s). |
/azp run |
Azure Pipelines successfully started running 1 pipeline(s). |
/azp run |
Azure Pipelines successfully started running 1 pipeline(s). |
/azp run |
Azure Pipelines successfully started running 1 pipeline(s). |
@@ -4,8 +4,8 @@ | |||
<Import Project=".\Common.Dotnet.PrepareGeneratedFolder.targets" /> | |||
|
|||
<PropertyGroup> | |||
<WindowsSdkPackageVersion>10.0.22621.57</WindowsSdkPackageVersion> | |||
<TargetFramework>net9.0-windows10.0.22621.0</TargetFramework> | |||
<WindowsSdkPackageVersion>10.0.26100.68-preview</WindowsSdkPackageVersion> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks like since we specified SupportedOSPlatformVersion, during build time will tell us as warning if we access any API only support in higher version of OS.
I don't see warning about API usage like CA1416;CS8776, we should be good.
src/modules/cmdpal/ExtensionTemplate/TemplateCmdPalExtension/Directory.Packages.props
Outdated
Show resolved
Hide resolved
/azp run |
Azure Pipelines successfully started running 1 pipeline(s). |
## Summary of the Pull Request Adds basic support for finding, listing, and executing Windows App Actions on files found by the Microsoft.CmdPal.Ext.Indexer extension. ## PR Checklist - [X] **Closes:** #39926 - [X] **Communication:** I've discussed this with core contributors already. If work hasn't been agreed, this work might be rejected - [ ] **Tests:** Added/updated and all pass - [X] **Localization:** All end user facing strings can be localized - [ ] **Dev docs:** Added/updated - [ ] **New binaries:** Added on the required places - [ ] [JSON for signing](https://github.com/microsoft/PowerToys/blob/main/.pipelines/ESRPSigning_core.json) for new binaries - [ ] [WXS for installer](https://github.com/microsoft/PowerToys/blob/main/installer/PowerToysSetup/Product.wxs) for new binaries and localization folder - [ ] [YML for CI pipeline](https://github.com/microsoft/PowerToys/blob/main/.pipelines/ci/templates/build-powertoys-steps.yml) for new test projects - [ ] [YML for signed pipeline](https://github.com/microsoft/PowerToys/blob/main/.pipelines/release.yml) - [ ] **Documentation updated:** If checked, please file a pull request on [our docs repo](https://github.com/MicrosoftDocs/windows-uwp/tree/docs/hub/powertoys) and link it here: #xxx ## Detailed Description of the Pull Request / Additional comments We also update cswin32 to stable version. <!-- Describe how you validated the behavior. Add automated tests wherever possible, but list manual validation steps taken as well --> ## Validation Steps Performed Validated that it doesn't show on older versions of Windows (<26100 insiders) and that it does work on newer version that have the App Actions runtime. --------- Co-authored-by: Gordon Lam (SH) <yeelam@microsoft.com> Co-authored-by: Mike Griese <migrie@microsoft.com> Co-authored-by: Leilei Zhang <leilzh@microsoft.com>
Summary of the Pull Request
Adds basic support for finding, listing, and executing Windows App Actions on files found by the Microsoft.CmdPal.Ext.Indexer extension.
PR Checklist
Detailed Description of the Pull Request / Additional comments
We also update cswin32 to stable version.
Validation Steps Performed
Validated that it doesn't show on older versions of Windows (<26100 insiders) and that it does work on newer version that have the App Actions runtime.