-
Notifications
You must be signed in to change notification settings - Fork 6.9k
[DSC] Implement Microsoft.PowerToys.Configure DSCResource & winget support #30918
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
[DSC] Implement Microsoft.PowerToys.Configure DSCResource & winget support #30918
Conversation
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
I don't know how this will work inside PowerToys code. But we have to make sure that the Group Policies always in any case have the highest priority! |
@htcfreek good point, thanks. In general, we must ensure that when a setting value in .json is edited - it's correctly applied and respected by both Settings and a module. I'm afraid we'll encounter a number of bugs and we'll have to solve it in a setting-by-setting manner. |
3c69103
to
c99dd8e
Compare
This comment has been minimized.
This comment has been minimized.
…e support
c99dd8e
to
d7663d6
Compare
Implemented the remaining TODO items and merged the latest main. |
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 lots of work went into refactoring some weird behaviors we had. Great work! I've done a first review and have some nits / questions.
Copyright = '(c) Microsoft Corporation. All rights reserved.' | ||
|
||
# Description of the functionality provided by this module | ||
# Description = '' |
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 fill out any of these to comply? Can you please check for some advisory on this?
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.
sent an email with the question regarding this
directives: | ||
description: Configure PowerToys | ||
settings: | ||
Debug: true |
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.
Is this one needed? Why is Debug
on this sample? It seems to be on every sample. I guess the samples don't need debug, since that's only for debugging.
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.
Debug
is used so it's possible to test DSC without building an installer and performing an installation each time you change something. Changed to false
.
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.
@yuyoyuppe , why change it to false? It can be deleted from the file too, right?
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 can be deleted, yes. It's convenient to have it here though.
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.
If these are the samples we are providing for people to look, please remove the Delete.
Debug: true | ||
PowerLauncher: | ||
Enabled: true | ||
AdditionalProperties: |
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.
Why are plugins inside Additional Properties? That looks a bit weird.
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.
Plugins have multiple things that do not comply with the rest of the settings:
- They're stored separately from
Properties
field unlike all other settings, seePowerLauncherSettings
- They are stored in a
IEnumerable
which makes identifying them difficult, thus the inferring of "key" property (Name
only at the moment) inSetAdditionalSettingsCommandLineCommand.Execute
. Also, it's not clear whether we should append/combine/overwrite the elements inIEnumerable
.
So yeah, currently they exist as a kind of special case due to their structure and extensibility.
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.
@yuyoyuppe
For policies we use the plugin id as identification because this is the only thing that is 100% unique. From what I have in mind PowerLauncher deduplicates based on the id and newest version/date.
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.
Why is it named "AdditionalProperties", though? Is that the name in the json file?
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.
That's just the name I've picked. We could change it to something else.
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.
So ti means we can just have "Plugins" instead of "Additional Properties>Plugins"? That would be preferred.
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 way it works is more general than that though 🤔. Currently, it's a bit limited in terms of the supported types, but the logic could be extended to support all the properties, i.e. not only Plugins for PowerRun, but for the rest of the properties as well.
@@ -69,6 +70,7 @@ public ImageResizerProperties(Func<string, string> resourceLoader) | |||
public StringProperty ImageresizerFileName { get; set; } | |||
|
|||
[JsonPropertyName("imageresizer_sizes")] | |||
[CmdConfigureIgnoreAttribute] |
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.
So right now we're unable to do the ImageResizer sizes we want from DSC. Can we please document in the .md the current settings we're unable to configure at this moment? This looks like one that would be useful. Not saying we do it for V1, but we should keep track of what we're missing.
public GenericProperty<string> ActiveConfiguration { get; set; } | ||
|
||
// List of all Keyboard Configurations. | ||
[JsonPropertyName("keyboardConfigurations")] | ||
[CmdConfigureIgnoreAttribute] | ||
public GenericProperty<List<string>> KeyboardConfigurations { get; set; } |
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.
Are we able to do KBM mappings through the DSC currently?
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, doing multilevel generics needs additional handling.
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.
Can we please have a sample for this added, then? ;) Thank you!
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.
Eh, meant to say we can't do it yet. 😐
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 add a list of the Settings we don't currently support setting to the documentation.
src/dsc/Microsoft.PowerToys.Configure/examples/enableAllModules.dsc.yaml
Outdated
Show resolved
Hide resolved
Enabled: true | ||
VideoConference: | ||
Enabled: true | ||
MeasureTool: |
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.
On Settings we're showing different names for these, so we might need to add comments to the samples so people can understand what we're talking about for the ones that don't look like the names in the product. Thinking Measure Tool is actually Screen Ruler and Power Ocr is actually Text Extractor, for example. Or can we have aliases for these?
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.
My idea was to add the documentation for all the settings. Having an alias is a good idea as well, I'll take a look
Plugins: | ||
- Name: "Calculator" | ||
Disabled: true |
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 only support disabled state?
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.
we support both states, that's just naming of the plugin properties 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.
Unclear asked. Is this the only setting you can set?
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 think we should support other options as well. Not the nested objects though. I'll compose a list of settable options for all modules and create a PR in https://github.com/MicrosoftDocs/windows-dev-docs/blob/docs/hub/powertoys/index.md
# Conflicts: # PowerToys.sln
IgnoreHotkeysInFullscreen: false | ||
ClearInputOnLaunch: false | ||
TabSelectsContextButtons: false | ||
Theme: HighContrastBlack |
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.
Wonder about this value. Is it matching to a selectable value in the settings ui?
SortByUsageFrequency: false | ||
StartSelectionFromTheLeft: false | ||
|
||
PowerLauncher: |
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.
Missing the plugin sample for PT Run?
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.
Looking at this the all Setting sample contains mostly noise. I think it's better to remove it at this point 🤷
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.
There's still some changes that are required, I think. Or oversights in the changes.
<Directory Id="PowerShellModulesFolder" Name="Modules"> | ||
<Directory Id="PowerToysDscFolder" Name="Microsoft.PowerToys.Configure"> | ||
<Directory Id="PowerToysDscVerFolder" Name="$(var.Version)"> | ||
<Component Id="PowerToysDSC" Win64="yes" Guid="4A033E3B-6590-43FD-8FBD-27F9DF557F7F"> |
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.
Can we make the component not fail the installation if the component is not able to be installed?
src/dsc/Microsoft.PowerToys.Configure/examples/allSettings.dsc.yaml
Outdated
Show resolved
Hide resolved
src/dsc/Microsoft.PowerToys.Configure/examples/allSettings.dsc.yaml
Outdated
Show resolved
Hide resolved
Enabled: true | ||
Plugins: | ||
- Name: "Calculator" | ||
Disabled: true |
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.
Are other fields configurable here too for the plugins?
@@ -49,6 +58,7 @@ public class PowerLauncherProperties | |||
public Theme Theme { get; set; } | |||
|
|||
[JsonPropertyName("show_plugins_overview")] | |||
[CmdConfigureIgnore] | |||
public int ShowPluginsOverview { get; set; } |
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.
Why is this one ignored too?
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's there on Settings, but it's an int instead of an Enum. We need to look into how to support it later on.
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.
LGTM with the latest changes. Good enough for a V1, at least. Thank you. Now waiting for CI to run before merging.
@yuyoyuppe , @jaimecbernardo |
Summary of the Pull Request
Allows to configure most of PowerToys settings using
winget configure
like this:PR Checklist
Detailed Description of the Pull Request / Additional comments
Validation Steps Performed