Add DSC v3 profile resource to deploy key and shortcut remappings#49427
Open
Gijsreyn wants to merge 3 commits into
Open
Add DSC v3 profile resource to deploy key and shortcut remappings#49427Gijsreyn wants to merge 3 commits into
Gijsreyn wants to merge 3 commits into
Conversation
|
Azure Pipelines: There may be pipelines that require an authorized user to comment /azp run to run. |
|
|
||
| [JsonPropertyName("runProgramStartInDir")] | ||
| [JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingNull)] | ||
| public string RunProgramStartInDir { get; set; } |
Contributor
There was a problem hiding this comment.
Since the DSC implementation is currently depending on shared Keyboard Manager/UI code, I think it’s worth reconsidering this model change. The safer design may be for DSC to own its own storage/model types and translate to the shared library shape only where needed, rather than expanding the shared model for DSC-specific needs. I’m not a maintainer on this area, but my guess is the team may prefer keeping DSC-specific augmentation isolated from the shared library contract
This file contains hidden or 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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary of the Pull Request
Adds a new DSC v3 resource,
profile(Microsoft.PowerToys/KeyboardManagerProfile), toPowerToys.DSC.exethat makes Keyboard Manager key and shortcut remappings deployable viadsc.exeandwinget configure. Until now, DSC only controlled whether Keyboard Manager is enabled — the actual remappings could only be created through the Keyboard Manager editor UI.Remappings are authored with friendly, layout-invariant key names instead of raw virtual-key codes:
The resource supports
get/set/test/export/schema/manifest, applies replace-whole-profile semantics (declarative desired state), writes the exact profile encoding the C++ editor produces, and signals a running Keyboard Manager engine to reload the remappings immediately, meaning no PowerToys restart is required.PR Checklist
export+set)PowerToys.DSCResources.resx; generated DSC manifest descriptions are deliberately not localized, matching the existingsettingsresource)doc/dsc/profile-resource.md,doc/dsc/overview.md,doc/dsc/modules/KeyboardManager.md,doc/devdocs/core/settings/dsc-configure.md)PowerToys.DSC.exe. The additional generated manifest (microsoft.powertoys.KeyboardManager.profile.dsc.resource.json) is picked up automatically by the installer's unfilteredDSCModules\component glob (generateAllFileComponents.ps1)PowerToys.DSC.UnitTestsprojectDetailed Description of the Pull Request / Additional comments
As remarked by @AmelBawa-msft on the issue, rempapings don't live in
settings.json. They're stored in a separate profile file:%LOCALAPPDATA%\Microsoft\PowerToys\Keyboard Manager\<activeConfiguration>.json. The only KBM properties that reference it insettings.jsonare marked[CmdConfigureIgnore]((activeConfiguration,keyboardConfigurations).The legacy PowerShell-based
PowerToysConfigure(v2/winget 0.2 schema) path was deliberately not chosen. It drives settings through a scalarPowerToys.Settings.exe set <Module>.<Property> <value>protocol; nested lists only work through the special-casedsetAdditionalside-channel, which merges by aNamekey into the module'ssettings.jsonand cannot target the separate profile file. ItsSet()also would have killed, requiring a restart for PowerToys.The style is also in friendly strings and not in
HotkeySettings-stylish, as the shape couldn't express what remappings it needed.