[GPO] Add policy to disable Awake's indefinitely mode#48025
Open
raihua wants to merge 25 commits into
Open
Conversation
Author
|
@microsoft-github-policy-service agree |
daverayment
suggested changes
May 21, 2026
Collaborator
There was a problem hiding this comment.
Hi. Thanks for your contribution. There are a few issues with this which need attention:
PR template
- Your linked issue is incorrect
- You've noted that you've communicated with maintainers, but not provided a link to the approval to work on this
- You've noted that you've updated tests, but there aren't any new ones here, or changes to existing ones
The PR itself
- Your PowerToys.adml and PowerToys.admx files are in the wrong place. They need to be under src/gpo/assets/en-US and src/gpo/assets respectively
- The new configuration setting
ConfigureEnabledAwakeIndefinitelyin the .adml is not named according to the convention, which isConfigureEnabledUtility<UtilityName><UtilityFeature>. It should likely beConfigureEnabledUtilityAwakeIndefiniteMode - The naming throughout is not ideal.
AwakeIndefinitelyshould likely be a noun phrase likeAwakeIndefiniteModeorAwakeIndefiniteModeEnabledwhere relevant - The policy in the .admx file has a
supportedOnproperty ofSUPPORTED_POWERTOYS_0_99_2. This is incorrect, as this new feature won't be supported until PowerToys 0.101 at the earliest. We'll need another definition to cover this, e.g.SUPPORTED_POWERTOYS_0_101_0 - Please don't update the version number of the .admx or .adml files. This doesn't refer to the revision of the files, but the version of the ADMX/ADML format itself
- Have you tested with GPEdit.msc? This is the tool used to edit the settings themselves. The registry should not be edited directly. Please provide some screenshots to show this, as it illustrates that the .admx and .adml files are in the correct format and that your text is being displayed correctly
- The tray menu entry is disabled with no indication to the user why it's unavailable. This isn't great UX. We should likely append " (disabled by admin)" or similar
- The setting seems to only apply to interactions with the tray menu. What happens if the user runs Awake via the CLI? Your write-up suggests that this is a known issue. If that's the case, then the PR should be a draft, as it's still a work in progress. If a user can simply run Awake via the command line to get around the restriction, it's not working properly
- It's wrong to persist GPO properties to the settings.json file. GPO is a read-only resource and the settings.json is at a different layer, i.e. user-editable and untrusted.
IndefiniteEnabledValueshould not be added toAwakePropertiesor persisted to settings.json. GPO values should be read directly from the registry at runtime via the appropriateGetConfigured...Valuemethod - It would be useful to have the setting output in the console when Awake in run via the CLI, e.g. "The option to keep awake indefinitely has been disabled by your administrator". You will also need to think about error messages and the appropriate flow for when the user doesn't set an expiry time or interval and indefinite mode is disabled
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
This introduces a group policy to disable Awake's "Indefinitely" mode.
This PR follows the implementation of how Enabled state is managed by group policy.
The Indefinite state is saved in settings.json of module settings.
On file read, it reads the group policies value again to prevent users from enabling via settings.json.
PR Checklist
Detailed Description of the Pull Request / Additional comments
Updated PowerToys.adml.
Updated ADMX file:
Updated code:
Could not:
Updated Bug report tool:
Validation Steps Performed
Screenshots