From e4d305284b15593cd1ae2118f0c64231cab3f41e Mon Sep 17 00:00:00 2001 From: Vyas Devgna <141345367+vyas-devgna@users.noreply.github.com> Date: Fri, 5 Jun 2026 01:58:37 +0530 Subject: [PATCH] feat: detect reverted tweaks on startup (#4582) Co-authored-by: vyas-devgna --- functions/public/Invoke-WPFtweaksbutton.ps1 | 1 + scripts/main.ps1 | 11 +++++++++++ 2 files changed, 12 insertions(+) diff --git a/functions/public/Invoke-WPFtweaksbutton.ps1 b/functions/public/Invoke-WPFtweaksbutton.ps1 index 1c413a66..e47a1542 100644 --- a/functions/public/Invoke-WPFtweaksbutton.ps1 +++ b/functions/public/Invoke-WPFtweaksbutton.ps1 @@ -82,5 +82,6 @@ function Invoke-WPFtweaksbutton { Write-Host "=================================" Write-Host "-- Tweaks are Finished ---" Write-Host "=================================" + @($tweaks | Where-Object { $sync.configs.tweaks.$_.registry -or $sync.configs.tweaks.$_.service }) | ConvertTo-Json | Out-File "$env:LocalAppData\winutil\lastrun.json" -Force } } diff --git a/scripts/main.ps1 b/scripts/main.ps1 index 4f7c7cbc..dbd94a52 100644 --- a/scripts/main.ps1 +++ b/scripts/main.ps1 @@ -400,6 +400,17 @@ $sync["Form"].Add_ContentRendered({ Invoke-WPFTab "WPFTab1BT" # Default to install tab } + if (-not $PARAM_CONFIG -and (Test-Path "$winutildir\lastrun.json")) { + try { + $drifted = @(Get-Content "$winutildir\lastrun.json" | ConvertFrom-Json | Where-Object { $_ -notin (Invoke-WinUtilCurrentSystem -CheckBox "tweaks") }) + if ($drifted.Count -gt 0 -and [System.Windows.MessageBox]::Show("$($drifted.Count) tweak(s) were reverted since last run. Re-select them?", "Winutil", "YesNo", "Question") -eq "Yes") { + Update-WinUtilSelections -flatJson $drifted + Reset-WPFCheckBoxes -doToggles $false + Invoke-WPFTab "WPFTab2BT" + } + } catch {} + } + $sync["Form"].Focus() if ($PARAM_CONFIG -and -not [string]::IsNullOrWhiteSpace($PARAM_CONFIG)) {