Skip to content

Add option to revert previous changes to windows defaults#528

Open
Raphire wants to merge 17 commits intomasterfrom
undo-tweaks
Open

Add option to revert previous changes to windows defaults#528
Raphire wants to merge 17 commits intomasterfrom
undo-tweaks

Conversation

@Raphire
Copy link
Copy Markdown
Owner

@Raphire Raphire commented Mar 22, 2026

This adds the ability to revert changes back to Windows defaults using the provided undo files. This is still a WIP, the current implementation only supports reverting changes for the current user.

Copy link
Copy Markdown

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Adds an “undo/revert” capability to Win11Debloat so previously applied tweaks can be reverted back toward Windows defaults, leveraging per-feature undo metadata in Config/Features.json and exposing the workflow via both CLI and the GUI home screen.

Changes:

  • Introduces -Undo mode and supporting helper logic to execute undo-capable features via RegistryUndoKey/UndoAction.
  • Adds a new GUI “Revert previous changes” entry point and modal to select revertable settings and apply them.
  • Updates feature Action/Label phrasing for better “Action + Label” composition and adds an undo .reg file for Windows Suggestions.

Reviewed changes

Copilot reviewed 13 out of 14 changed files in this pull request and generated 3 comments.

Show a summary per file
File Description
Win11Debloat.ps1 Adds -Undo, wires new modal schema/script, adds undo guard, and refactors required-path validation.
Scripts/Helpers/GetUndoFeatureForParam.ps1 New helper to detect whether a param/feature supports undo based on Features metadata.
Scripts/GUI/Show-RevertSettingsModal.ps1 New WPF modal to choose which previously-applied settings to revert.
Scripts/GUI/Show-MainWindow.ps1 Adds “Revert previous changes” link and applies selected undo targets via existing apply flow.
Scripts/GUI/Show-ApplyModal.ps1 Tweaks completion messaging text.
Scripts/Get.ps1 Adds -Undo pass-through support for the bootstrap/downloader script.
Scripts/Features/ExecuteChanges.ps1 Implements undo execution path using undo regfiles, and filters non-undoable params in undo mode.
Scripts/CLI/PrintPendingChanges.ps1 Updates CLI pending-changes summary behavior for undo mode (with noted messaging issues).
Schemas/SharedStyles.xaml Adds a shared link-style button (ActionLinkButtonStyle).
Schemas/RevertSettingsWindow.xaml New modal window schema for selecting revertable settings.
Schemas/MainWindow.xaml Adds “Revert previous changes” link and refactors review link to use shared style; updates checkbox visuals.
Schemas/ApplyChangesWindow.xaml Adjusts apply-window button sizing/content layout.
Regfiles/Undo/Enable_Windows_Suggestions.reg Adds undo regfile referenced by Features metadata.
Config/Features.json Adjusts Action/Label phrasing and contains undo metadata mapping for relevant features.
Comments suppressed due to low confidence (1)

Scripts/CLI/PrintPendingChanges.ps1:9

  • CreateRestorePoint is printed using only the feature Label, but this PR changed that label to "a system restore point", resulting in output like "- a system restore point". PrintPendingChanges should include the Action as well (or restore a verb phrase label) so the CLI summary remains clear.
    if ($script:Params['CreateRestorePoint']) {
        Write-Output "- $($script:Features['CreateRestorePoint'].Label)"
    }

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread Win11Debloat.ps1
Comment thread Scripts/CLI/PrintPendingChanges.ps1 Outdated
Comment thread Scripts/GUI/Show-RevertSettingsModal.ps1 Outdated
Copy link
Copy Markdown

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 13 out of 14 changed files in this pull request and generated 1 comment.

Comments suppressed due to low confidence (1)

Scripts/CLI/PrintPendingChanges.ps1:15

  • CreateRestorePoint is printed using only Features['CreateRestorePoint'].Label. After the Features.json change, the label is now just "a system restore point", so the CLI summary will render as "- a system restore point" (missing the verb). Consider printing Action + Label here (or using ApplyText) so the output stays grammatical and consistent with other entries.
    if ($script:Params['CreateRestorePoint']) {
        Write-Output "- $($script:Features['CreateRestorePoint'].Label)"
    }

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread Scripts/Features/ExecuteChanges.ps1 Outdated
Copy link
Copy Markdown

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 13 out of 14 changed files in this pull request and generated 1 comment.

Comments suppressed due to low confidence (1)

Scripts/CLI/PrintPendingChanges.ps1:15

  • CreateRestorePoint is printed using only Features['CreateRestorePoint'].Label. With the updated Features.json values (Action="Create", Label="a system restore point"), the CLI output becomes "- a system restore point" (missing the verb). Either keep the label as a full phrase again, or update this output to use Action + Label (and handle Action being null).
    if ($script:Params['CreateRestorePoint']) {
        Write-Output "- $($script:Features['CreateRestorePoint'].Label)"
    }

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread Scripts/CLI/PrintPendingChanges.ps1 Outdated
@Addust
Copy link
Copy Markdown

Addust commented Apr 20, 2026

i seriously hope the irony of having microsoft bloat help review PRs on a codebase meant to excise microsoft bloat isn't lost on anyone here

@Raphire
Copy link
Copy Markdown
Owner Author

Raphire commented Apr 20, 2026

i seriously hope the irony of having microsoft bloat help review PRs on a codebase meant to excise microsoft bloat isn't lost on anyone here

😅

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants