mirror of
https://github.com/ChrisTitusTech/winutil.git
synced 2026-08-10 01:51:18 +10:00
Compare commits
9
Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
43b6721df7 | ||
|
|
0c42b9e458 | ||
|
|
26f89adf95 | ||
|
|
5003f14e0a | ||
|
|
8b6098b36a | ||
|
|
1f0756336f | ||
|
|
0f39648de6 | ||
|
|
7f0d2183e3 | ||
|
|
6ae24d071d |
@@ -81,7 +81,7 @@ jobs:
|
||||
run: "cd docs && [[ -f package-lock.json || -f npm-shrinkwrap.json ]] && npm ci || true"
|
||||
- name: Cache Restore
|
||||
id: cache-restore
|
||||
uses: actions/cache/restore@v5
|
||||
uses: actions/cache/restore@v6
|
||||
with:
|
||||
path: |
|
||||
${{ runner.temp }}/hugo_cache
|
||||
@@ -97,7 +97,7 @@ jobs:
|
||||
--cacheDir "${{ runner.temp }}/hugo_cache"
|
||||
- name: Cache Save
|
||||
id: cache-save
|
||||
uses: actions/cache/save@v5
|
||||
uses: actions/cache/save@v6
|
||||
with:
|
||||
path: |
|
||||
${{ runner.temp }}/hugo_cache
|
||||
|
||||
@@ -77,7 +77,7 @@ See https://github.com/ChrisTitusTech/winutil/blob/main/.github/CONTRIBUTING.md
|
||||
|
||||
These are the sponsors that help keep this project alive with monthly contributions.
|
||||
|
||||
<!-- sponsors --><a href="https://github.com/dwelfusius"><img src="https://github.com/dwelfusius.png" width="60px" alt="User avatar: " /></a><a href="https://github.com/mews-se"><img src="https://github.com/mews-se.png" width="60px" alt="User avatar: Martin Stockzell" /></a><a href="https://github.com/jdiegmueller"><img src="https://github.com/jdiegmueller.png" width="60px" alt="User avatar: Jason A. Diegmueller" /></a><a href="https://github.com/robertsandrock"><img src="https://github.com/robertsandrock.png" width="60px" alt="User avatar: RMS" /></a><a href="https://github.com/paulsheets"><img src="https://github.com/paulsheets.png" width="60px" alt="User avatar: Paul" /></a><a href="https://github.com/djones369"><img src="https://github.com/djones369.png" width="60px" alt="User avatar: Dave J (WhamGeek)" /></a><a href="https://github.com/anthonymendez"><img src="https://github.com/anthonymendez.png" width="60px" alt="User avatar: Anthony Mendez" /></a><a href="https://github.com/FatBastard0"><img src="https://github.com/FatBastard0.png" width="60px" alt="User avatar: " /></a><a href="https://github.com/DursleyGuy"><img src="https://github.com/DursleyGuy.png" width="60px" alt="User avatar: DursleyGuy" /></a><a href="https://github.com/DwayneTheRockLobster1"><img src="https://github.com/DwayneTheRockLobster1.png" width="60px" alt="User avatar: " /></a><a href="https://github.com/KieraKujisawa"><img src="https://github.com/KieraKujisawa.png" width="60px" alt="User avatar: Kiera Meredith" /></a><a href="https://github.com/andrewpayne68"><img src="https://github.com/andrewpayne68.png" width="60px" alt="User avatar: Andrew P" /></a><!-- sponsors -->
|
||||
<!-- sponsors --><a href="https://github.com/ysaito8015"><img src="https://github.com/ysaito8015.png" width="60px" alt="User avatar: Yusuke Saito" /></a><a href="https://github.com/dwelfusius"><img src="https://github.com/dwelfusius.png" width="60px" alt="User avatar: " /></a><a href="https://github.com/mews-se"><img src="https://github.com/mews-se.png" width="60px" alt="User avatar: Martin Stockzell" /></a><a href="https://github.com/jdiegmueller"><img src="https://github.com/jdiegmueller.png" width="60px" alt="User avatar: Jason A. Diegmueller" /></a><a href="https://github.com/robertsandrock"><img src="https://github.com/robertsandrock.png" width="60px" alt="User avatar: RMS" /></a><a href="https://github.com/paulsheets"><img src="https://github.com/paulsheets.png" width="60px" alt="User avatar: Paul" /></a><a href="https://github.com/djones369"><img src="https://github.com/djones369.png" width="60px" alt="User avatar: Dave J (WhamGeek)" /></a><a href="https://github.com/anthonymendez"><img src="https://github.com/anthonymendez.png" width="60px" alt="User avatar: Anthony Mendez" /></a><a href="https://github.com/FatBastard0"><img src="https://github.com/FatBastard0.png" width="60px" alt="User avatar: " /></a><a href="https://github.com/DursleyGuy"><img src="https://github.com/DursleyGuy.png" width="60px" alt="User avatar: DursleyGuy" /></a><a href="https://github.com/DwayneTheRockLobster1"><img src="https://github.com/DwayneTheRockLobster1.png" width="60px" alt="User avatar: " /></a><a href="https://github.com/KieraKujisawa"><img src="https://github.com/KieraKujisawa.png" width="60px" alt="User avatar: Kiera Meredith" /></a><a href="https://github.com/andrewpayne68"><img src="https://github.com/andrewpayne68.png" width="60px" alt="User avatar: Andrew P" /></a><a href="https://github.com/johanwildeboer"><img src="https://github.com/johanwildeboer.png" width="60px" alt="User avatar: " /></a><a href="https://github.com/lukas346"><img src="https://github.com/lukas346.png" width="60px" alt="User avatar: Wook" /></a><a href="https://github.com/tsv31"><img src="https://github.com/tsv31.png" width="60px" alt="User avatar: Sorin" /></a><!-- sponsors -->
|
||||
|
||||
---
|
||||
|
||||
|
||||
+18
-6
@@ -91,8 +91,7 @@
|
||||
"OriginalValue": "<RemoveEntry>"
|
||||
}
|
||||
],
|
||||
"link": "https://winutil.christitus.com/dev/tweaks/essential-tweaks/revertstartmenu",
|
||||
"link": "https://winutil.christitus.com/dev/tweaks/essential-tweaks/revertstartmenu"
|
||||
"link": "https://winutil.christitus.com/dev/tweaks/essential-tweaks/revertstartmenu"
|
||||
},
|
||||
"WPFTweaksDisableStoreSearch": {
|
||||
"Content": "Microsoft Store Recommended Search Results - Disable",
|
||||
@@ -587,15 +586,25 @@
|
||||
},
|
||||
"WPFTweaksRemoveEdge": {
|
||||
"Content": "Microsoft Edge - Remove",
|
||||
"Description": "Unblocks Microsoft Edge uninstaller restrictions then uses that uninstaller to remove Microsoft Edge.",
|
||||
"Description": "Uninstalls Microsoft Edge by creating dummy MicrosoftEdge.exe file in the legacy Edge folder. This tricks Windows into unlocking the official Edge uninstaller allowing for a system-level removal.",
|
||||
"category": "z__Advanced Tweaks - CAUTION",
|
||||
"panel": "1",
|
||||
"InvokeScript": [
|
||||
"Invoke-WinUtilRemoveEdge"
|
||||
"
|
||||
$Path = Resolve-Path -Path \"$Env:ProgramFiles (x86)\\Microsoft\\Edge\\Application\\*\\Installer\\setup.exe\" | Select-Object -Last 1
|
||||
|
||||
if (Test-Path $Path) {
|
||||
New-Item -Path \"$Env:SystemRoot\\SystemApps\\Microsoft.MicrosoftEdge_8wekyb3d8bbwe\\MicrosoftEdge.exe\" -Force
|
||||
Start-Process -FilePath $Path -ArgumentList \"--uninstall --system-level --force-uninstall --delete-profile\" -Wait
|
||||
Write-Host \"Microsoft Edge was removed\"
|
||||
} else {
|
||||
Write-Host \"Microsoft Edge is not installed\"
|
||||
}
|
||||
"
|
||||
],
|
||||
"UndoScript": [
|
||||
"
|
||||
Write-Host 'Installing Microsoft Edge...'
|
||||
Write-Host \"Installing Microsoft Edge...\"
|
||||
winget install Microsoft.Edge --source winget
|
||||
"
|
||||
],
|
||||
@@ -969,7 +978,10 @@
|
||||
|
||||
Get-AppxPackage -AllUsers \"*Copilot*\" | Remove-AppxPackage -AllUsers
|
||||
Get-AppxPackage -AllUsers Microsoft.MicrosoftOfficeHub | Remove-AppxPackage -AllUsers
|
||||
Remove-AppxPackage $Appx
|
||||
|
||||
if ($Appx) {
|
||||
Remove-AppxPackage $Appx
|
||||
}
|
||||
|
||||
Set-Service -Name WSAIFabricSvc -StartupType Disabled
|
||||
Disable-WindowsOptionalFeature -FeatureName Recall -Online -NoRestart
|
||||
|
||||
@@ -3,7 +3,7 @@ title: "System Tray Battery Percentage"
|
||||
description: ""
|
||||
---
|
||||
|
||||
```json {filename="config/tweaks.json",linenos=inline,linenostart=1303}
|
||||
```json {filename="config/tweaks.json",linenos=inline,linenostart=1315}
|
||||
"WPFToggleBatteryPercentage": {
|
||||
"Content": "System Tray Battery Percentage",
|
||||
"Description": "Shows numeric battery percentage next to the battery icon in the system tray.",
|
||||
|
||||
@@ -3,7 +3,7 @@ title: "Start Menu Bing Search"
|
||||
description: ""
|
||||
---
|
||||
|
||||
```json {filename="config/tweaks.json",linenos=inline,linenostart=1638}
|
||||
```json {filename="config/tweaks.json",linenos=inline,linenostart=1650}
|
||||
"WPFToggleBingSearch": {
|
||||
"Content": "Start Menu Bing Search",
|
||||
"Description": "Toggles Bing web search results in Windows Search.",
|
||||
|
||||
@@ -3,7 +3,7 @@ title: "Dark Theme for Windows"
|
||||
description: ""
|
||||
---
|
||||
|
||||
```json {filename="config/tweaks.json",linenos=inline,linenostart=1321}
|
||||
```json {filename="config/tweaks.json",linenos=inline,linenostart=1333}
|
||||
"WPFToggleDarkMode": {
|
||||
"Content": "Dark Theme for Windows",
|
||||
"Description": "Dark Mode for the system and applications.",
|
||||
|
||||
@@ -3,7 +3,7 @@ title: "BSoD Verbose Mode"
|
||||
description: ""
|
||||
---
|
||||
|
||||
```json {filename="config/tweaks.json",linenos=inline,linenostart=1277}
|
||||
```json {filename="config/tweaks.json",linenos=inline,linenostart=1289}
|
||||
"WPFToggleDetailedBSoD": {
|
||||
"Content": "BSoD Verbose Mode",
|
||||
"Description": "Gives more information when you blue screen.",
|
||||
|
||||
@@ -3,7 +3,7 @@ title: "Lock Screen - Disable"
|
||||
description: ""
|
||||
---
|
||||
|
||||
```json {filename="config/tweaks.json",linenos=inline,linenostart=1674}
|
||||
```json {filename="config/tweaks.json",linenos=inline,linenostart=1686}
|
||||
"WPFTweaksDisableLockscreen": {
|
||||
"Content": "Lock Screen - Disable",
|
||||
"Description": "Skips the lock screen entirely and goes directly to the sign-in screen on boot and wake.",
|
||||
|
||||
@@ -3,7 +3,7 @@ title: "Game Mode"
|
||||
description: ""
|
||||
---
|
||||
|
||||
```json {filename="config/tweaks.json",linenos=inline,linenostart=1817}
|
||||
```json {filename="config/tweaks.json",linenos=inline,linenostart=1829}
|
||||
"WPFToggleGameMode": {
|
||||
"Content": "Game Mode",
|
||||
"Description": "Toggles Windows prioritizes gaming performance by allocating system resources to games.",
|
||||
|
||||
@@ -3,7 +3,7 @@ title: "File Explorer Hidden Files"
|
||||
description: ""
|
||||
---
|
||||
|
||||
```json {filename="config/tweaks.json",linenos=inline,linenostart=1391}
|
||||
```json {filename="config/tweaks.json",linenos=inline,linenostart=1403}
|
||||
"WPFToggleHiddenFiles": {
|
||||
"Content": "File Explorer Hidden Files",
|
||||
"Description": "Reveals hidden files in Explorer.",
|
||||
|
||||
@@ -3,7 +3,7 @@ title: "Settings Home Page"
|
||||
description: ""
|
||||
---
|
||||
|
||||
```json {filename="config/tweaks.json",linenos=inline,linenostart=1620}
|
||||
```json {filename="config/tweaks.json",linenos=inline,linenostart=1632}
|
||||
"WPFToggleHideSettingsHome": {
|
||||
"Content": "Settings Home Page",
|
||||
"Description": "Toggles the Home Page in the Windows Settings app.",
|
||||
|
||||
@@ -3,7 +3,7 @@ title: "Logon Screen Acrylic Blur"
|
||||
description: ""
|
||||
---
|
||||
|
||||
```json {filename="config/tweaks.json",linenos=inline,linenostart=1656}
|
||||
```json {filename="config/tweaks.json",linenos=inline,linenostart=1668}
|
||||
"WPFToggleLoginBlur": {
|
||||
"Content": "Logon Screen Acrylic Blur",
|
||||
"Description": "Toggles the acrylic blur effect on login screen background.",
|
||||
|
||||
@@ -3,7 +3,7 @@ title: "Enable Long Paths"
|
||||
description: ""
|
||||
---
|
||||
|
||||
```json {filename="config/tweaks.json",linenos=inline,linenostart=1843}
|
||||
```json {filename="config/tweaks.json",linenos=inline,linenostart=1855}
|
||||
"WPFToggleLongPaths": {
|
||||
"Content": "Enable Long Paths",
|
||||
"Description": "Toggles support for file paths longer than 260 characters in Explorer.",
|
||||
|
||||
@@ -3,7 +3,7 @@ title: "Mouse Acceleration"
|
||||
description: ""
|
||||
---
|
||||
|
||||
```json {filename="config/tweaks.json",linenos=inline,linenostart=1524}
|
||||
```json {filename="config/tweaks.json",linenos=inline,linenostart=1536}
|
||||
"WPFToggleMouseAcceleration": {
|
||||
"Content": "Mouse Acceleration",
|
||||
"Description": "Makes it so Cursor movement is affected by the speed of your physical mouse movements.",
|
||||
|
||||
@@ -3,7 +3,7 @@ title: "Multiplane Overlay"
|
||||
description: ""
|
||||
---
|
||||
|
||||
```json {filename="config/tweaks.json",linenos=inline,linenostart=1498}
|
||||
```json {filename="config/tweaks.json",linenos=inline,linenostart=1510}
|
||||
"WPFToggleMultiplaneOverlay": {
|
||||
"Content": "Multiplane Overlay",
|
||||
"Description": "Multiplane Overlay compose multiple image layers, which can sometimes cause issues with graphics cards.",
|
||||
|
||||
@@ -3,7 +3,7 @@ title: "Microsoft Outlook New Version"
|
||||
description: ""
|
||||
---
|
||||
|
||||
```json {filename="config/tweaks.json",linenos=inline,linenostart=1437}
|
||||
```json {filename="config/tweaks.json",linenos=inline,linenostart=1449}
|
||||
"WPFToggleNewOutlook": {
|
||||
"Content": "Microsoft Outlook New Version",
|
||||
"Description": "This will ensures the classic Outlook application is used.",
|
||||
|
||||
@@ -3,7 +3,7 @@ title: "Num Lock on Startup"
|
||||
description: ""
|
||||
---
|
||||
|
||||
```json {filename="config/tweaks.json",linenos=inline,linenostart=1558}
|
||||
```json {filename="config/tweaks.json",linenos=inline,linenostart=1570}
|
||||
"WPFToggleNumLock": {
|
||||
"Content": "Num Lock on Startup",
|
||||
"Description": "Toggle the Num Lock key state when your computer starts.",
|
||||
|
||||
@@ -3,7 +3,7 @@ title: "S3 Sleep"
|
||||
description: ""
|
||||
---
|
||||
|
||||
```json {filename="config/tweaks.json",linenos=inline,linenostart=1602}
|
||||
```json {filename="config/tweaks.json",linenos=inline,linenostart=1614}
|
||||
"WPFToggleS3Sleep": {
|
||||
"Content": "S3 Sleep",
|
||||
"Description": "Toggles between Modern Standby and S3 Sleep, which cuts off power to the CPU while continuing to refresh the memory.",
|
||||
|
||||
@@ -3,6 +3,25 @@ title: "Scrollbars Always Visible"
|
||||
description: ""
|
||||
---
|
||||
|
||||
```json {filename="config/tweaks.json",linenos=inline,linenostart=1491}
|
||||
"WPFToggleScrollbars": {
|
||||
"Content": "Scrollbars Always Visible",
|
||||
"Description": "If enabled, scrollbars will always be visible. If disabled, Windows will automatically hide scrollbars when not in use.",
|
||||
"category": "Customize Preferences",
|
||||
"panel": "2",
|
||||
"Type": "Toggle",
|
||||
"registry": [
|
||||
{
|
||||
"Path": "HKCU:\\Control Panel\\Accessibility",
|
||||
"Name": "DynamicScrollbars",
|
||||
"Value": "0",
|
||||
"Type": "DWord",
|
||||
"OriginalValue": "1",
|
||||
"DefaultState": "false",
|
||||
"link": "https://winutil.christitus.com/dev/tweaks/customize-preferences/scrollbars"
|
||||
}
|
||||
],
|
||||
```
|
||||
|
||||
## Registry Changes
|
||||
|
||||
|
||||
@@ -3,7 +3,7 @@ title: "File Explorer File Extensions"
|
||||
description: ""
|
||||
---
|
||||
|
||||
```json {filename="config/tweaks.json",linenos=inline,linenostart=1363}
|
||||
```json {filename="config/tweaks.json",linenos=inline,linenostart=1375}
|
||||
"WPFToggleShowExt": {
|
||||
"Content": "File Explorer File Extensions",
|
||||
"Description": "Shows .file extensions in Explorer (.exe, .png, etc.)",
|
||||
|
||||
@@ -3,7 +3,7 @@ title: "S0 Sleep Network Connectivity"
|
||||
description: ""
|
||||
---
|
||||
|
||||
```json {filename="config/tweaks.json",linenos=inline,linenostart=1584}
|
||||
```json {filename="config/tweaks.json",linenos=inline,linenostart=1596}
|
||||
"WPFToggleStandbyFix": {
|
||||
"Content": "S0 Sleep Network Connectivity",
|
||||
"Description": "Toggles network connectivity during S0 Sleep which is low power idle in modern laptops.",
|
||||
|
||||
@@ -3,7 +3,7 @@ title: "Start Menu Recommendations"
|
||||
description: ""
|
||||
---
|
||||
|
||||
```json {filename="config/tweaks.json",linenos=inline,linenostart=1691}
|
||||
```json {filename="config/tweaks.json",linenos=inline,linenostart=1703}
|
||||
"WPFToggleStartMenuRecommendations": {
|
||||
"Content": "Start Menu Recommendations",
|
||||
"Description": "Toggles the recommendations section in the Start Menu. WARNING: This will also disable Windows Spotlight on your Lock Screen as a side effect.",
|
||||
|
||||
@@ -3,7 +3,7 @@ title: "Sticky Keys"
|
||||
description: ""
|
||||
---
|
||||
|
||||
```json {filename="config/tweaks.json",linenos=inline,linenostart=1735}
|
||||
```json {filename="config/tweaks.json",linenos=inline,linenostart=1747}
|
||||
"WPFToggleStickyKeys": {
|
||||
"Content": "Sticky Keys",
|
||||
"Description": "Toggles the Sticky Keys, which activate when clicking shift rapidly.",
|
||||
|
||||
@@ -3,7 +3,7 @@ title: "Taskbar Task View Icon"
|
||||
description: ""
|
||||
---
|
||||
|
||||
```json {filename="config/tweaks.json",linenos=inline,linenostart=1799}
|
||||
```json {filename="config/tweaks.json",linenos=inline,linenostart=1811}
|
||||
"WPFToggleTaskView": {
|
||||
"Content": "Taskbar Task View Icon",
|
||||
"Description": "Toggles the Task View Button in the Taskbar.",
|
||||
|
||||
@@ -3,7 +3,7 @@ title: "Taskbar Centered Icons"
|
||||
description: ""
|
||||
---
|
||||
|
||||
```json {filename="config/tweaks.json",linenos=inline,linenostart=1753}
|
||||
```json {filename="config/tweaks.json",linenos=inline,linenostart=1765}
|
||||
"WPFToggleTaskbarAlignment": {
|
||||
"Content": "Taskbar Centered Icons",
|
||||
"Description": "Toggles the Taskbar alignment either to the left or center.",
|
||||
|
||||
@@ -3,7 +3,7 @@ title: "Taskbar Search Icon"
|
||||
description: ""
|
||||
---
|
||||
|
||||
```json {filename="config/tweaks.json",linenos=inline,linenostart=1781}
|
||||
```json {filename="config/tweaks.json",linenos=inline,linenostart=1793}
|
||||
"WPFToggleTaskbarSearch": {
|
||||
"Content": "Taskbar Search Icon",
|
||||
"Description": "Toggles the Search Button on the Taskbar.",
|
||||
|
||||
@@ -3,7 +3,7 @@ title: "Logon Verbose Mode"
|
||||
description: ""
|
||||
---
|
||||
|
||||
```json {filename="config/tweaks.json",linenos=inline,linenostart=1419}
|
||||
```json {filename="config/tweaks.json",linenos=inline,linenostart=1431}
|
||||
"WPFToggleVerboseLogon": {
|
||||
"Content": "Logon Verbose Mode",
|
||||
"Description": "Show detailed messages during startup/shutdown.",
|
||||
|
||||
@@ -3,7 +3,7 @@ title: "ConsumerFeatures - Disable"
|
||||
description: ""
|
||||
---
|
||||
|
||||
```json {filename="config/tweaks.json",linenos=inline,linenostart=431}
|
||||
```json {filename="config/tweaks.json",linenos=inline,linenostart=430}
|
||||
"WPFTweaksConsumerFeatures": {
|
||||
"Content": "ConsumerFeatures - Disable",
|
||||
"Description": "Windows will not automatically install any games, third-party apps, or application links from the Windows Store for the signed-in user. Some default Apps will be inaccessible (e.g. Phone Link).",
|
||||
|
||||
@@ -3,7 +3,7 @@ title: "Unwanted Pre-Installed Apps - Remove"
|
||||
description: ""
|
||||
---
|
||||
|
||||
```json {filename="config/tweaks.json",linenos=inline,linenostart=829}
|
||||
```json {filename="config/tweaks.json",linenos=inline,linenostart=838}
|
||||
"WPFTweaksDeBloat": {
|
||||
"Content": "Unwanted Pre-Installed Apps - Remove",
|
||||
"Description": "This will remove a bunch of Windows pre-installed applications which most people dont want on their system.",
|
||||
|
||||
@@ -3,7 +3,7 @@ title: "Temporary Files - Remove"
|
||||
description: ""
|
||||
---
|
||||
|
||||
```json {filename="config/tweaks.json",linenos=inline,linenostart=1117}
|
||||
```json {filename="config/tweaks.json",linenos=inline,linenostart=1129}
|
||||
"WPFTweaksDeleteTempFiles": {
|
||||
"Content": "Temporary Files - Remove",
|
||||
"Description": "Erases TEMP Folders.",
|
||||
|
||||
@@ -3,7 +3,7 @@ title: "Delivery Optimization - Disable"
|
||||
description: ""
|
||||
---
|
||||
|
||||
```json {filename="config/tweaks.json",linenos=inline,linenostart=572}
|
||||
```json {filename="config/tweaks.json",linenos=inline,linenostart=571}
|
||||
"WPFTweaksDeliveryOptimization": {
|
||||
"Content": "Delivery Optimization - Disable",
|
||||
"Description": "Stops Windows from using your bandwidth to upload updates to other PCs on the internet or local network.",
|
||||
|
||||
@@ -3,7 +3,7 @@ title: "BitLocker - Disable"
|
||||
description: ""
|
||||
---
|
||||
|
||||
```json {filename="config/tweaks.json",linenos=inline,linenostart=604}
|
||||
```json {filename="config/tweaks.json",linenos=inline,linenostart=613}
|
||||
"WPFTweaksDisableBitLocker": {
|
||||
"Content": "BitLocker - Disable",
|
||||
"Description": "Disables BitLocker.",
|
||||
|
||||
@@ -3,7 +3,7 @@ title: "File Explorer Automatic Folder Discovery - Disable"
|
||||
description: ""
|
||||
---
|
||||
|
||||
```json {filename="config/tweaks.json",linenos=inline,linenostart=1222}
|
||||
```json {filename="config/tweaks.json",linenos=inline,linenostart=1234}
|
||||
"WPFTweaksDisableExplorerAutoDiscovery": {
|
||||
"Content": "File Explorer Automatic Folder Discovery - Disable",
|
||||
"Description": "Windows Explorer automatically tries to guess the type of the folder based on its contents, slowing down the browsing experience. WARNING! Will disable File Explorer grouping.",
|
||||
|
||||
@@ -3,7 +3,7 @@ title: "Microsoft Store Recommended Search Results - Disable"
|
||||
description: ""
|
||||
---
|
||||
|
||||
```json {filename="config/tweaks.json",linenos=inline,linenostart=97}
|
||||
```json {filename="config/tweaks.json",linenos=inline,linenostart=96}
|
||||
"WPFTweaksDisableStoreSearch": {
|
||||
"Content": "Microsoft Store Recommended Search Results - Disable",
|
||||
"Description": "Will not display recommended Microsoft Store apps when searching for apps in the Start menu.",
|
||||
|
||||
@@ -3,7 +3,7 @@ title: "Disk Cleanup - Run"
|
||||
description: ""
|
||||
---
|
||||
|
||||
```json {filename="config/tweaks.json",linenos=inline,linenostart=1104}
|
||||
```json {filename="config/tweaks.json",linenos=inline,linenostart=1116}
|
||||
"WPFTweaksDiskCleanup": {
|
||||
"Content": "Disk Cleanup - Run",
|
||||
"Description": "Runs Disk Cleanup on Drive C: and removes old Windows Updates.",
|
||||
|
||||
@@ -3,7 +3,7 @@ title: "End Task With Right Click - Enable"
|
||||
description: ""
|
||||
---
|
||||
|
||||
```json {filename="config/tweaks.json",linenos=inline,linenostart=910}
|
||||
```json {filename="config/tweaks.json",linenos=inline,linenostart=919}
|
||||
"WPFTweaksEndTaskOnTaskbar": {
|
||||
"Content": "End Task With Right Click - Enable",
|
||||
"Description": "Enables option to end task when right clicking a program in the taskbar.",
|
||||
|
||||
@@ -3,7 +3,7 @@ title: "Location Tracking - Disable"
|
||||
description: ""
|
||||
---
|
||||
|
||||
```json {filename="config/tweaks.json",linenos=inline,linenostart=110}
|
||||
```json {filename="config/tweaks.json",linenos=inline,linenostart=109}
|
||||
"WPFTweaksLocation": {
|
||||
"Content": "Location Tracking - Disable",
|
||||
"Description": "Disables Location Tracking.",
|
||||
|
||||
@@ -3,7 +3,7 @@ title: "Restore Point - Create"
|
||||
description: ""
|
||||
---
|
||||
|
||||
```json {filename="config/tweaks.json",linenos=inline,linenostart=883}
|
||||
```json {filename="config/tweaks.json",linenos=inline,linenostart=892}
|
||||
"WPFTweaksRestorePoint": {
|
||||
"Content": "Restore Point - Create",
|
||||
"Description": "Creates a restore point at runtime in case a revert is needed from WinUtil modifications.",
|
||||
|
||||
@@ -3,6 +3,22 @@ title: "Start Menu Previous Layout - Enable"
|
||||
description: ""
|
||||
---
|
||||
|
||||
```json {filename="config/tweaks.json",linenos=inline,linenostart=80}
|
||||
"WPFTweaksRevertStartMenu": {
|
||||
"Content": "Start Menu Previous Layout - Enable",
|
||||
"Description": "Bring back the old Start Menu layout from before the gradual rollout of the new one in 25H2. On newer versions of Windows !!THIS TWEAK WILL NOT WORK!!",
|
||||
"category": "Essential Tweaks",
|
||||
"panel": "1",
|
||||
"registry": [
|
||||
{
|
||||
"Path": "HKLM:\\SYSTEM\\ControlSet001\\Control\\FeatureManagement\\Overrides\\8\\3036241548",
|
||||
"Name": "EnabledState",
|
||||
"Value": "1",
|
||||
"Type": "DWord",
|
||||
"OriginalValue": "<RemoveEntry>"
|
||||
}
|
||||
],
|
||||
```
|
||||
|
||||
## Registry Changes
|
||||
|
||||
|
||||
@@ -3,7 +3,7 @@ title: "Services - Set to Manual"
|
||||
description: ""
|
||||
---
|
||||
|
||||
```json {filename="config/tweaks.json",linenos=inline,linenostart=147}
|
||||
```json {filename="config/tweaks.json",linenos=inline,linenostart=146}
|
||||
"WPFTweaksServices": {
|
||||
"Content": "Services - Set to Manual",
|
||||
"Description": "Sets some services to Manual startup and adjusts the SvcHostSplitThresholdInKB registry value to better match system memory, which can significantly reduce the number of svchost.exe processes.",
|
||||
|
||||
@@ -3,7 +3,7 @@ title: "Telemetry - Disable"
|
||||
description: ""
|
||||
---
|
||||
|
||||
```json {filename="config/tweaks.json",linenos=inline,linenostart=447}
|
||||
```json {filename="config/tweaks.json",linenos=inline,linenostart=446}
|
||||
"WPFTweaksTelemetry": {
|
||||
"Content": "Telemetry - Disable",
|
||||
"Description": "Disables Microsoft Telemetry.",
|
||||
|
||||
@@ -3,7 +3,7 @@ title: "Windows Platform Binary Table (WPBT) - Disable"
|
||||
description: ""
|
||||
---
|
||||
|
||||
```json {filename="config/tweaks.json",linenos=inline,linenostart=982}
|
||||
```json {filename="config/tweaks.json",linenos=inline,linenostart=994}
|
||||
"WPFTweaksWPBT": {
|
||||
"Content": "Windows Platform Binary Table (WPBT) - Disable",
|
||||
"Description": "If enabled, WPBT allows your computer vendor to execute programs at boot time, such as anti-theft software, software drivers, as well as force install software without user consent. Poses potential security risk.",
|
||||
|
||||
@@ -3,7 +3,7 @@ title: "Adobe URL Block List - Enable"
|
||||
description: ""
|
||||
---
|
||||
|
||||
```json {filename="config/tweaks.json",linenos=inline,linenostart=1062}
|
||||
```json {filename="config/tweaks.json",linenos=inline,linenostart=1074}
|
||||
"WPFTweaksBlockAdobeNet": {
|
||||
"Content": "Adobe URL Block List - Enable",
|
||||
"Description": "Reduces user interruptions by selectively blocking connections to Adobe's activation and telemetry servers. Credit: Ruddernation-Designs",
|
||||
|
||||
@@ -3,7 +3,7 @@ title: "Brave Browser - Debloat"
|
||||
description: ""
|
||||
---
|
||||
|
||||
```json {filename="config/tweaks.json",linenos=inline,linenostart=187}
|
||||
```json {filename="config/tweaks.json",linenos=inline,linenostart=186}
|
||||
"WPFTweaksBraveDebloat": {
|
||||
"Content": "Brave Browser - Debloat",
|
||||
"Description": "Disables various annoyances like Brave Rewards, Leo AI, Crypto Wallet and VPN.",
|
||||
|
||||
@@ -3,7 +3,7 @@ title: "Background Apps - Disable"
|
||||
description: ""
|
||||
---
|
||||
|
||||
```json {filename="config/tweaks.json",linenos=inline,linenostart=1190}
|
||||
```json {filename="config/tweaks.json",linenos=inline,linenostart=1202}
|
||||
"WPFTweaksDisableBGapps": {
|
||||
"Content": "Background Apps - Disable",
|
||||
"Description": "Disables all Microsoft Store apps from running in the background, which has to be done individually since Windows 11.",
|
||||
|
||||
@@ -3,7 +3,7 @@ title: "Fullscreen Optimizations - Disable"
|
||||
description: ""
|
||||
---
|
||||
|
||||
```json {filename="config/tweaks.json",linenos=inline,linenostart=1206}
|
||||
```json {filename="config/tweaks.json",linenos=inline,linenostart=1218}
|
||||
"WPFTweaksDisableFSO": {
|
||||
"Content": "Fullscreen Optimizations - Disable",
|
||||
"Description": "Disables FSO in all applications. NOTE: This will disable Color Management in Exclusive Fullscreen.",
|
||||
|
||||
@@ -3,7 +3,7 @@ title: "IPv6 - Disable"
|
||||
description: ""
|
||||
---
|
||||
|
||||
```json {filename="config/tweaks.json",linenos=inline,linenostart=1168}
|
||||
```json {filename="config/tweaks.json",linenos=inline,linenostart=1180}
|
||||
"WPFTweaksDisableIPv6": {
|
||||
"Content": "IPv6 - Disable",
|
||||
"Description": "Disables IPv6.",
|
||||
|
||||
@@ -3,7 +3,7 @@ title: "System Tray Notifications & Calendar - Disable"
|
||||
description: ""
|
||||
---
|
||||
|
||||
```json {filename="config/tweaks.json",linenos=inline,linenostart=1039}
|
||||
```json {filename="config/tweaks.json",linenos=inline,linenostart=1051}
|
||||
"WPFTweaksDisableNotifications": {
|
||||
"Content": "System Tray Notifications & Calendar - Disable",
|
||||
"Description": "Disables all Notifications INCLUDING Calendar.",
|
||||
|
||||
+1
-1
@@ -3,7 +3,7 @@ title: "RDP Unsigned File Warnings - Disable"
|
||||
description: ""
|
||||
---
|
||||
|
||||
```json {filename="config/tweaks.json",linenos=inline,linenostart=280}
|
||||
```json {filename="config/tweaks.json",linenos=inline,linenostart=279}
|
||||
"WPFTweaksDisableWarningForUnsignedRdp": {
|
||||
"Content": "RDP Unsigned File Warnings - Disable",
|
||||
"Description": "Disables warnings shown when launching unsigned RDP files introduced with the latest Windows 10 and 11 updates.",
|
||||
|
||||
@@ -3,7 +3,7 @@ title: "Visual Effects - Set to Best Performance"
|
||||
description: ""
|
||||
---
|
||||
|
||||
```json {filename="config/tweaks.json",linenos=inline,linenostart=707}
|
||||
```json {filename="config/tweaks.json",linenos=inline,linenostart=716}
|
||||
"WPFTweaksDisplay": {
|
||||
"Content": "Visual Effects - Set to Best Performance",
|
||||
"Description": "Sets the system preferences to performance. You can do this manually with sysdm.cpl as well.",
|
||||
|
||||
@@ -3,7 +3,7 @@ title: "Microsoft Edge - Debloat"
|
||||
description: ""
|
||||
---
|
||||
|
||||
```json {filename="config/tweaks.json",linenos=inline,linenostart=303}
|
||||
```json {filename="config/tweaks.json",linenos=inline,linenostart=302}
|
||||
"WPFTweaksEdgeDebloat": {
|
||||
"Content": "Microsoft Edge - Debloat",
|
||||
"Description": "Disables various telemetry options, popups, and other annoyances in Edge.",
|
||||
|
||||
@@ -3,7 +3,7 @@ title: "IPv6 - Set IPv4 as Preferred"
|
||||
description: ""
|
||||
---
|
||||
|
||||
```json {filename="config/tweaks.json",linenos=inline,linenostart=1130}
|
||||
```json {filename="config/tweaks.json",linenos=inline,linenostart=1142}
|
||||
"WPFTweaksIPv46": {
|
||||
"Content": "IPv6 - Set IPv4 as Preferred",
|
||||
"Description": "Setting the IPv4 preference can have latency and security benefits on private networks where IPv6 is not configured.",
|
||||
|
||||
@@ -3,7 +3,7 @@ title: "Razer Software Auto-Install - Disable"
|
||||
description: ""
|
||||
---
|
||||
|
||||
```json {filename="config/tweaks.json",linenos=inline,linenostart=998}
|
||||
```json {filename="config/tweaks.json",linenos=inline,linenostart=1010}
|
||||
"WPFTweaksRazerBlock": {
|
||||
"Content": "Razer Software Auto-Install - Disable",
|
||||
"Description": "Blocks ALL Razer Software installations. The hardware works fine without any software.",
|
||||
|
||||
@@ -3,18 +3,28 @@ title: "Microsoft Edge - Remove"
|
||||
description: ""
|
||||
---
|
||||
|
||||
```json {filename="config/tweaks.json",linenos=inline,linenostart=588}
|
||||
```json {filename="config/tweaks.json",linenos=inline,linenostart=587}
|
||||
"WPFTweaksRemoveEdge": {
|
||||
"Content": "Microsoft Edge - Remove",
|
||||
"Description": "Unblocks Microsoft Edge uninstaller restrictions then uses that uninstaller to remove Microsoft Edge.",
|
||||
"Description": "Uninstalls Microsoft Edge by creating dummy MicrosoftEdge.exe file in the legacy Edge folder. This tricks Windows into unlocking the official Edge uninstaller allowing for a system-level removal.",
|
||||
"category": "z__Advanced Tweaks - CAUTION",
|
||||
"panel": "1",
|
||||
"InvokeScript": [
|
||||
"Invoke-WinUtilRemoveEdge"
|
||||
"
|
||||
$Path = Resolve-Path -Path \"$Env:ProgramFiles (x86)\\Microsoft\\Edge\\Application\\*\\Installer\\setup.exe\" | Select-Object -Last 1
|
||||
|
||||
if (Test-Path $Path) {
|
||||
New-Item -Path \"$Env:SystemRoot\\SystemApps\\Microsoft.MicrosoftEdge_8wekyb3d8bbwe\\MicrosoftEdge.exe\" -Force
|
||||
Start-Process -FilePath $Path -ArgumentList \"--uninstall --system-level --force-uninstall --delete-profile\" -Wait
|
||||
Write-Host \"Microsoft Edge was removed\"
|
||||
} else {
|
||||
Write-Host \"Microsoft Edge is not installed\"
|
||||
}
|
||||
"
|
||||
],
|
||||
"UndoScript": [
|
||||
"
|
||||
Write-Host 'Installing Microsoft Edge...'
|
||||
Write-Host \"Installing Microsoft Edge...\"
|
||||
winget install Microsoft.Edge --source winget
|
||||
"
|
||||
],
|
||||
|
||||
@@ -3,7 +3,7 @@ title: "File Explorer Home and Gallery - Disable"
|
||||
description: ""
|
||||
---
|
||||
|
||||
```json {filename="config/tweaks.json",linenos=inline,linenostart=677}
|
||||
```json {filename="config/tweaks.json",linenos=inline,linenostart=686}
|
||||
"WPFTweaksRemoveHomeAndGallery": {
|
||||
"Content": "File Explorer Home and Gallery - Disable",
|
||||
"Description": "Removes the Home and Gallery from Explorer and sets This PC as default.",
|
||||
|
||||
@@ -3,7 +3,7 @@ title: "Microsoft OneDrive - Remove"
|
||||
description: ""
|
||||
---
|
||||
|
||||
```json {filename="config/tweaks.json",linenos=inline,linenostart=633}
|
||||
```json {filename="config/tweaks.json",linenos=inline,linenostart=642}
|
||||
"WPFTweaksRemoveOneDrive": {
|
||||
"Content": "Microsoft OneDrive - Remove",
|
||||
"Description": "Denies permission to remove OneDrive user files, then uses its own uninstaller to remove it and restores the original permission afterward.",
|
||||
|
||||
@@ -3,7 +3,7 @@ title: "Disable Reserved Storage"
|
||||
description: ""
|
||||
---
|
||||
|
||||
```json {filename="config/tweaks.json",linenos=inline,linenostart=870}
|
||||
```json {filename="config/tweaks.json",linenos=inline,linenostart=879}
|
||||
"WPFTweaksReservedStorage": {
|
||||
"Content": "Disable Reserved Storage",
|
||||
"Description": "Disables Windows Reserved Storage (7-10 GB held for updates/temp files). Recommended only on small drives. Re-enable before major Windows feature updates to avoid installation failures.",
|
||||
|
||||
@@ -3,7 +3,7 @@ title: "Right-Click Menu Previous Layout - Enable"
|
||||
description: ""
|
||||
---
|
||||
|
||||
```json {filename="config/tweaks.json",linenos=inline,linenostart=1088}
|
||||
```json {filename="config/tweaks.json",linenos=inline,linenostart=1100}
|
||||
"WPFTweaksRightClickMenu": {
|
||||
"Content": "Right-Click Menu Previous Layout - Enable",
|
||||
"Description": "Restores the classic context menu when right-clicking in File Explorer, replacing the simplified Windows 11 version.",
|
||||
|
||||
@@ -3,7 +3,7 @@ title: "Storage Sense - Disable"
|
||||
description: ""
|
||||
---
|
||||
|
||||
```json {filename="config/tweaks.json",linenos=inline,linenostart=926}
|
||||
```json {filename="config/tweaks.json",linenos=inline,linenostart=935}
|
||||
"WPFTweaksStorage": {
|
||||
"Content": "Storage Sense - Disable",
|
||||
"Description": "Storage Sense deletes temp files automatically.",
|
||||
|
||||
@@ -3,7 +3,7 @@ title: "Teredo - Disable"
|
||||
description: ""
|
||||
---
|
||||
|
||||
```json {filename="config/tweaks.json",linenos=inline,linenostart=1146}
|
||||
```json {filename="config/tweaks.json",linenos=inline,linenostart=1158}
|
||||
"WPFTweaksTeredo": {
|
||||
"Content": "Teredo - Disable",
|
||||
"Description": "Teredo network tunneling is an IPv6 feature that can cause additional latency, but may cause problems with some games.",
|
||||
|
||||
@@ -3,7 +3,7 @@ title: "Date & Time - Set Time to UTC"
|
||||
description: ""
|
||||
---
|
||||
|
||||
```json {filename="config/tweaks.json",linenos=inline,linenostart=617}
|
||||
```json {filename="config/tweaks.json",linenos=inline,linenostart=626}
|
||||
"WPFTweaksUTC": {
|
||||
"Content": "Date & Time - Set Time to UTC",
|
||||
"Description": "Essential for computers that are dual booting. Fixes the time sync with Linux systems.",
|
||||
|
||||
@@ -3,7 +3,7 @@ title: "Windows AI - Disable And Remove"
|
||||
description: ""
|
||||
---
|
||||
|
||||
```json {filename="config/tweaks.json",linenos=inline,linenostart=942}
|
||||
```json {filename="config/tweaks.json",linenos=inline,linenostart=951}
|
||||
"WPFTweaksWindowsAI": {
|
||||
"Content": "Windows AI - Disable And Remove",
|
||||
"Description": "Removes and disables all AI features/packages",
|
||||
@@ -34,7 +34,10 @@ description: ""
|
||||
|
||||
Get-AppxPackage -AllUsers \"*Copilot*\" | Remove-AppxPackage -AllUsers
|
||||
Get-AppxPackage -AllUsers Microsoft.MicrosoftOfficeHub | Remove-AppxPackage -AllUsers
|
||||
Remove-AppxPackage $Appx
|
||||
|
||||
if ($Appx) {
|
||||
Remove-AppxPackage $Appx
|
||||
}
|
||||
|
||||
Set-Service -Name WSAIFabricSvc -StartupType Disabled
|
||||
Disable-WindowsOptionalFeature -FeatureName Recall -Online -NoRestart
|
||||
|
||||
@@ -3,7 +3,7 @@ title: "Xbox & Gaming Components - Remove"
|
||||
description: ""
|
||||
---
|
||||
|
||||
```json {filename="config/tweaks.json",linenos=inline,linenostart=806}
|
||||
```json {filename="config/tweaks.json",linenos=inline,linenostart=815}
|
||||
"WPFTweaksXboxRemoval": {
|
||||
"Content": "Xbox & Gaming Components - Remove",
|
||||
"Description": "Removes Xbox services, the Xbox app, Game Bar, and related authentication components.",
|
||||
|
||||
@@ -3,7 +3,7 @@ title: "DNS - Set to:"
|
||||
description: ""
|
||||
---
|
||||
|
||||
```json {filename="config/tweaks.json",linenos=inline,linenostart=1868}
|
||||
```json {filename="config/tweaks.json",linenos=inline,linenostart=1880}
|
||||
"WPFchangedns": {
|
||||
"Content": "DNS - Set to:",
|
||||
"category": "z__Advanced Tweaks - CAUTION",
|
||||
|
||||
@@ -92,6 +92,10 @@ function Invoke-WPFImpex {
|
||||
$sync.selectedFeatures = [System.Collections.Generic.List[string]]::new()
|
||||
|
||||
Update-WinUtilSelections -flatJson $flattenedJson
|
||||
|
||||
if ($sync.Form) {
|
||||
Reset-WPFCheckBoxes -doToggles $true
|
||||
}
|
||||
}
|
||||
} catch {
|
||||
Write-Error "An error occurred while importing: $_"
|
||||
|
||||
@@ -1,8 +0,0 @@
|
||||
function Invoke-WinUtilRemoveEdge {
|
||||
New-Item -Path "$Env:SystemRoot\SystemApps\Microsoft.MicrosoftEdge_8wekyb3d8bbwe\MicrosoftEdge.exe" -Force
|
||||
|
||||
$Path = Resolve-Path -Path "$Env:ProgramFiles (x86)\Microsoft\Edge\Application\*\Installer\setup.exe" | Select-Object -Last 1
|
||||
Start-Process -FilePath $Path -ArgumentList '--uninstall --system-level --force-uninstall --delete-profile' -Wait
|
||||
|
||||
Write-Host "Microsoft Edge was removed" -ForegroundColor Green
|
||||
}
|
||||
+92
-24
@@ -42,10 +42,26 @@ function Get-RawJsonBlock {
|
||||
return $null
|
||||
}
|
||||
|
||||
$escapedIndent = [regex]::Escape($startIndent)
|
||||
$endIndex = -1
|
||||
# Use brace-depth tracking to find the closing brace
|
||||
$endIndex = -1
|
||||
$depth = 1 # We're starting inside the opening brace
|
||||
for ($i = ($startIndex + 1); $i -lt $JsonLines.Count; $i++) {
|
||||
if ($JsonLines[$i] -match "^$escapedIndent\}") {
|
||||
$line = $JsonLines[$i]
|
||||
|
||||
# Count braces in this line, ignoring those in strings
|
||||
$inString = $false
|
||||
$chars = $line.ToCharArray()
|
||||
for ($k = 0; $k -lt $chars.Count; $k++) {
|
||||
if ($chars[$k] -eq '"' -and ($k -eq 0 -or $chars[$k-1] -ne '\')) {
|
||||
$inString = -not $inString
|
||||
} elseif (-not $inString) {
|
||||
if ($chars[$k] -eq '{') { $depth++ }
|
||||
elseif ($chars[$k] -eq '}') { $depth-- }
|
||||
}
|
||||
}
|
||||
|
||||
# Found the closing brace of the item
|
||||
if ($depth -eq 0) {
|
||||
$endIndex = $i
|
||||
break
|
||||
}
|
||||
@@ -121,34 +137,86 @@ function Add-LinkAttributeToJson {
|
||||
}
|
||||
if ($startIdx -eq -1) { continue }
|
||||
|
||||
# Derive indentation: propIndent is one level deeper than the item start.
|
||||
# Used to target only top-level properties and skip nested object braces.
|
||||
$null = $lines[$startIdx] -match '^(\s*)'
|
||||
$propIndent = $matches[1] + ' '
|
||||
$propIndentLen = $propIndent.Length
|
||||
$escapedPropIndent = [regex]::Escape($propIndent)
|
||||
# Derive indentation used by top-level properties in the item.
|
||||
# Prefer existing property indentation to avoid inheriting bad key indentation.
|
||||
$null = $lines[$startIdx] -match '^(\s*)'
|
||||
$propIndent = $matches[1] + ' '
|
||||
|
||||
# Scan forward: update existing "link" or find the closing brace to insert one.
|
||||
# Closing brace is matched by indent <= propIndentLen to handle inconsistent formatting.
|
||||
$linkUpdated = $false
|
||||
$closeBraceIdx = -1
|
||||
for ($j = $startIdx + 1; $j -lt $lines.Count; $j++) {
|
||||
if ($lines[$j] -match "^$escapedPropIndent`"link`"\s*:") {
|
||||
$lines[$j] = $lines[$j] -replace '"link"\s*:\s*"[^"]*"', "`"link`": `"$newLink`""
|
||||
$linkUpdated = $true
|
||||
$depthProbe = 1
|
||||
for ($p = $startIdx + 1; $p -lt $lines.Count; $p++) {
|
||||
$probeLine = $lines[$p]
|
||||
|
||||
if ($depthProbe -eq 1 -and $probeLine -match '^(\s*)"[^"]+"\s*:') {
|
||||
$propIndent = $matches[1]
|
||||
break
|
||||
}
|
||||
if ($lines[$j] -match '^\s*\}') {
|
||||
$null = $lines[$j] -match '^(\s*)'
|
||||
if ($matches[1].Length -le $propIndentLen) {
|
||||
$closeBraceIdx = $j
|
||||
break
|
||||
|
||||
$inStringProbe = $false
|
||||
$probeChars = $probeLine.ToCharArray()
|
||||
for ($q = 0; $q -lt $probeChars.Count; $q++) {
|
||||
if ($probeChars[$q] -eq '"' -and ($q -eq 0 -or $probeChars[$q-1] -ne '\')) {
|
||||
$inStringProbe = -not $inStringProbe
|
||||
} elseif (-not $inStringProbe) {
|
||||
if ($probeChars[$q] -eq '{') { $depthProbe++ }
|
||||
elseif ($probeChars[$q] -eq '}') { $depthProbe-- }
|
||||
}
|
||||
}
|
||||
|
||||
if ($depthProbe -eq 0) { break }
|
||||
}
|
||||
|
||||
# Scan forward: remove any existing "link" property and find the closing brace.
|
||||
# Use brace-depth tracking to properly handle nested structures like arrays.
|
||||
$closeBraceIdx = -1
|
||||
$depth = 1 # We're starting inside the opening brace of the item
|
||||
$linesToRemove = @()
|
||||
|
||||
for ($j = $startIdx + 1; $j -lt $lines.Count; $j++) {
|
||||
$line = $lines[$j]
|
||||
|
||||
# Check for existing "link" property at top-level (depth 1 before processing braces on this line)
|
||||
# Match at any indentation level (user may have manually changed indentation)
|
||||
if ($depth -eq 1 -and $line -match '^\s*"link"\s*:') {
|
||||
# Mark this line for removal
|
||||
$linesToRemove += $j
|
||||
}
|
||||
|
||||
# Count braces in this line, ignoring those in strings
|
||||
$inString = $false
|
||||
$chars = $line.ToCharArray()
|
||||
for ($k = 0; $k -lt $chars.Count; $k++) {
|
||||
if ($chars[$k] -eq '"' -and ($k -eq 0 -or $chars[$k-1] -ne '\')) {
|
||||
$inString = -not $inString
|
||||
} elseif (-not $inString) {
|
||||
if ($chars[$k] -eq '{') { $depth++ }
|
||||
elseif ($chars[$k] -eq '}') { $depth-- }
|
||||
}
|
||||
}
|
||||
|
||||
# Found the closing brace of the item
|
||||
if ($depth -eq 0) {
|
||||
$closeBraceIdx = $j
|
||||
break
|
||||
}
|
||||
}
|
||||
|
||||
if (-not $linkUpdated -and $closeBraceIdx -ne -1) {
|
||||
# Insert "link" before the closing brace
|
||||
# Remove old "link" lines in reverse order to preserve indices
|
||||
foreach ($idx in ($linesToRemove | Sort-Object -Descending)) {
|
||||
# If the line before had a trailing comma (from the link property), remove it
|
||||
if ($idx -gt $startIdx) {
|
||||
$prevLine = $lines[$idx - 1]
|
||||
if ($prevLine -match ',\s*$' -and $lines[$idx].Trim() -match '^}') {
|
||||
$lines[$idx - 1] = $prevLine -replace ',\s*$', ''
|
||||
}
|
||||
}
|
||||
$lines.RemoveAt($idx)
|
||||
if ($idx -lt $closeBraceIdx) {
|
||||
$closeBraceIdx--
|
||||
}
|
||||
}
|
||||
|
||||
# Now insert "link" before the closing brace (consistent position for all items)
|
||||
if ($closeBraceIdx -ne -1) {
|
||||
$prevPropIdx = $closeBraceIdx - 1
|
||||
while ($prevPropIdx -gt $startIdx -and $lines[$prevPropIdx].Trim() -eq '') { $prevPropIdx-- }
|
||||
|
||||
|
||||
Reference in New Issue
Block a user