From 4e96ca0c3c6ed8ab21dd61af48fdc46548103942 Mon Sep 17 00:00:00 2001 From: MyDrift Date: Fri, 6 Dec 2024 06:27:06 +0100 Subject: [PATCH 1/6] add WPFToggleRemoveRecommended - add WPFToggleStartMenuRecommendations - add reg entrys to modify for toggle - add non working link bc devdocs are broken in general --- config/tweaks.json | 42 +++++++++++++++++++++++++++++++++++++----- 1 file changed, 37 insertions(+), 5 deletions(-) diff --git a/config/tweaks.json b/config/tweaks.json index e296c552..8d445c92 100644 --- a/config/tweaks.json +++ b/config/tweaks.json @@ -3397,12 +3397,44 @@ ], "link": "https://christitustech.github.io/winutil/dev/tweaks/Customize-Preferences/VerboseLogon" }, + "WPFToggleStartMenuRecommendations": { + "Content": "Recommendations in Start Menu", + "Description": "If disabled then you will not see recommendations in the Start Menu. | Relogin Required.", + "category": "Customize Preferences", + "panel": "2", + "Order": "a104_", + "Type": "Toggle", + "registry": [ + { + "Path": "HKLM:\\SOFTWARE\\Microsoft\\PolicyManager\\current\\device\\Start", + "Name": "HideRecommendedSection", + "Value": "0", + "OriginalValue": "1", + "Type": "DWord" + }, + { + "Path": "HKLM:\\SOFTWARE\\Microsoft\\PolicyManager\\current\\device\\Education", + "Name": "IsEducationEnvironment", + "Value": "0", + "OriginalValue": "1", + "Type": "DWord" + }, + { + "Path": "HKLM:\\SOFTWARE\\Policies\\Microsoft\\Windows\\Explorer", + "Name": "HideRecommendedSection", + "Value": "0", + "OriginalValue": "1", + "Type": "DWord" + } + ], + "link": "https://christitustech.github.io/winutil/dev/tweaks/Customize-Preferences/WPFToggleStartMenuRecommendations" + }, "WPFToggleSnapWindow": { "Content": "Snap Window", "Description": "If enabled you can align windows by dragging them. | Relogin Required", "category": "Customize Preferences", "panel": "2", - "Order": "a104_", + "Order": "a105_", "Type": "Toggle", "registry": [ { @@ -3420,7 +3452,7 @@ "Description": "If enabled then Snap preview is disabled when maximize button is hovered.", "category": "Customize Preferences", "panel": "2", - "Order": "a105_", + "Order": "a106_", "Type": "Toggle", "registry": [ { @@ -3448,7 +3480,7 @@ "Description": "If enabled then you will get suggestions to snap other applications in the left over spaces.", "category": "Customize Preferences", "panel": "2", - "Order": "a106_", + "Order": "a107_", "Type": "Toggle", "registry": [ { @@ -3476,7 +3508,7 @@ "Description": "If Enabled then Cursor movement is affected by the speed of your physical mouse movements.", "category": "Customize Preferences", "panel": "2", - "Order": "a107_", + "Order": "a108_", "Type": "Toggle", "registry": [ { @@ -3508,7 +3540,7 @@ "Description": "If Enabled then Sticky Keys is activated - Sticky keys is an accessibility feature of some graphical user interfaces which assists users who have physical disabilities or help users reduce repetitive strain injury.", "category": "Customize Preferences", "panel": "2", - "Order": "a108_", + "Order": "a109_", "Type": "Toggle", "registry": [ { From 6b1a914e9e47c5b933569535c309caa8220b2443 Mon Sep 17 00:00:00 2001 From: MyDrift Date: Fri, 6 Dec 2024 21:46:33 +0100 Subject: [PATCH 2/6] add iseducationenvironment notice --- config/tweaks.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/config/tweaks.json b/config/tweaks.json index 8d445c92..6cb43537 100644 --- a/config/tweaks.json +++ b/config/tweaks.json @@ -3399,7 +3399,7 @@ }, "WPFToggleStartMenuRecommendations": { "Content": "Recommendations in Start Menu", - "Description": "If disabled then you will not see recommendations in the Start Menu. | Relogin Required.", + "Description": "If disabled then you will not see recommendations in the Start Menu. | Enables 'iseducationenvironment' | Relogin Required.", "category": "Customize Preferences", "panel": "2", "Order": "a104_", From a2c31008cf2e279cd1aca89da45e3bb05a5dca28 Mon Sep 17 00:00:00 2001 From: MyDrift Date: Mon, 9 Dec 2024 06:36:30 +0100 Subject: [PATCH 3/6] improve handling if entry does not exist - add DefaultState property - add handler for DefaultState in Get-WinUtilToggleStatus --- config/tweaks.json | 18 ++++++++++++++ functions/private/Get-WinUtilToggleStatus.ps1 | 24 ++++++++++++++++++- 2 files changed, 41 insertions(+), 1 deletion(-) diff --git a/config/tweaks.json b/config/tweaks.json index 6cb43537..0dccf41c 100644 --- a/config/tweaks.json +++ b/config/tweaks.json @@ -3349,6 +3349,7 @@ "Name": "BingSearchEnabled", "Value": "1", "OriginalValue": "0", + "DefaultState": "true", "Type": "DWord" } ], @@ -3392,6 +3393,7 @@ "Name": "VerboseStatus", "Value": "1", "OriginalValue": "0", + "DefaultState": "false", "Type": "DWord" } ], @@ -3410,6 +3412,7 @@ "Name": "HideRecommendedSection", "Value": "0", "OriginalValue": "1", + "DefaultState": "true", "Type": "DWord" }, { @@ -3417,6 +3420,7 @@ "Name": "IsEducationEnvironment", "Value": "0", "OriginalValue": "1", + "DefaultState": "true", "Type": "DWord" }, { @@ -3424,6 +3428,7 @@ "Name": "HideRecommendedSection", "Value": "0", "OriginalValue": "1", + "DefaultState": "true", "Type": "DWord" } ], @@ -3442,6 +3447,7 @@ "Name": "WindowArrangementActive", "Value": "1", "OriginalValue": "0", + "DefaultState": "true", "Type": "String" } ], @@ -3460,6 +3466,7 @@ "Name": "EnableSnapAssistFlyout", "Value": "1", "OriginalValue": "0", + "DefaultState": "true", "Type": "DWord" } ], @@ -3488,6 +3495,7 @@ "Name": "SnapAssist", "Value": "1", "OriginalValue": "0", + "DefaultState": "true", "Type": "DWord" } ], @@ -3516,6 +3524,7 @@ "Name": "MouseSpeed", "Value": "1", "OriginalValue": "0", + "DefaultState": "true", "Type": "DWord" }, { @@ -3523,6 +3532,7 @@ "Name": "MouseThreshold1", "Value": "6", "OriginalValue": "0", + "DefaultState": "true", "Type": "DWord" }, { @@ -3530,6 +3540,7 @@ "Name": "MouseThreshold2", "Value": "10", "OriginalValue": "0", + "DefaultState": "true", "Type": "DWord" } ], @@ -3548,6 +3559,7 @@ "Name": "Flags", "Value": "510", "OriginalValue": "58", + "DefaultState": "true", "Type": "DWord" } ], @@ -3622,6 +3634,7 @@ "Name": "SearchboxTaskbarMode", "Value": "1", "OriginalValue": "0", + "DefaultState": "true", "Type": "DWord" } ], @@ -3640,6 +3653,7 @@ "Name": "ShowTaskViewButton", "Value": "1", "OriginalValue": "0", + "DefaultState": "true", "Type": "DWord" } ], @@ -3658,6 +3672,7 @@ "Name": "TaskbarDa", "Value": "1", "OriginalValue": "0", + "DefaultState": "true", "Type": "DWord" } ], @@ -3676,6 +3691,7 @@ "Name": "TaskbarAl", "Value": "1", "OriginalValue": "0", + "DefaultState": "true", "Type": "DWord" } ], @@ -3694,6 +3710,7 @@ "Name": "DisplayParameters", "Value": "1", "OriginalValue": "0", + "DefaultState": "false", "Type": "DWord" }, { @@ -3701,6 +3718,7 @@ "Name": "DisableEmoticon", "Value": "1", "OriginalValue": "0", + "DefaultState": "false", "Type": "DWord" } ], diff --git a/functions/private/Get-WinUtilToggleStatus.ps1 b/functions/private/Get-WinUtilToggleStatus.ps1 index 3b0d329d..7084813e 100644 --- a/functions/private/Get-WinUtilToggleStatus.ps1 +++ b/functions/private/Get-WinUtilToggleStatus.ps1 @@ -35,6 +35,9 @@ Function Get-WinUtilToggleStatus { foreach ($regentry in $ToggleSwitchReg) { try { + if (!(Test-Path $regentry.Path)) { + New-Item -Path $regentry.Path -Force | Out-Null + } $regstate = (Get-ItemProperty -path $regentry.Path).$($regentry.Name) if ($regstate -eq $regentry.Value) { $count += 1 @@ -42,8 +45,27 @@ Function Get-WinUtilToggleStatus { } else { Write-Debug "$($regentry.Name) is false (state: $regstate, value: $($regentry.Value), original: $($regentry.OriginalValue))" } + if (!$regstate) { + write-host "missing $($regentry.Name)" + switch ($regentry.DefaultState) { + "true" { + write-host "true" + $regstate = $regentry.Value + $count += 1 + } + "false" { + write-host "false" + $regstate = $regentry.OriginalValue + } + default { + write-host "default" + Write-Error "Entry for $($regentry.Name) does not exist and no DefaultState is defined." + $regstate = $regentry.OriginalValue + } + } + } } catch { - Write-Error "An error occurred while accessing registry entry $($regentry.Path): $_" + Write-Error "An unexpected error occurred: $_" } } From faad84da46fdf59800241b82ad0f8d727da34b28 Mon Sep 17 00:00:00 2001 From: MyDrift Date: Tue, 10 Dec 2024 23:22:03 +0100 Subject: [PATCH 4/6] remove helper console logs --- functions/private/Get-WinUtilToggleStatus.ps1 | 4 ---- 1 file changed, 4 deletions(-) diff --git a/functions/private/Get-WinUtilToggleStatus.ps1 b/functions/private/Get-WinUtilToggleStatus.ps1 index 7084813e..a19dbf9b 100644 --- a/functions/private/Get-WinUtilToggleStatus.ps1 +++ b/functions/private/Get-WinUtilToggleStatus.ps1 @@ -46,19 +46,15 @@ Function Get-WinUtilToggleStatus { Write-Debug "$($regentry.Name) is false (state: $regstate, value: $($regentry.Value), original: $($regentry.OriginalValue))" } if (!$regstate) { - write-host "missing $($regentry.Name)" switch ($regentry.DefaultState) { "true" { - write-host "true" $regstate = $regentry.Value $count += 1 } "false" { - write-host "false" $regstate = $regentry.OriginalValue } default { - write-host "default" Write-Error "Entry for $($regentry.Name) does not exist and no DefaultState is defined." $regstate = $regentry.OriginalValue } From 295b5a4095b31be900497a9c1cd4e4f9d8af4682 Mon Sep 17 00:00:00 2001 From: MyDrift Date: Tue, 10 Dec 2024 23:36:28 +0100 Subject: [PATCH 5/6] fix search defaultstate --- config/tweaks.json | 2 ++ 1 file changed, 2 insertions(+) diff --git a/config/tweaks.json b/config/tweaks.json index 0dccf41c..0ebf1670 100644 --- a/config/tweaks.json +++ b/config/tweaks.json @@ -3308,6 +3308,7 @@ "Name": "AppsUseLightTheme", "Value": "0", "OriginalValue": "1", + "DefaultState": "false", "Type": "DWord" }, { @@ -3315,6 +3316,7 @@ "Name": "SystemUsesLightTheme", "Value": "0", "OriginalValue": "1", + "DefaultState": "false", "Type": "DWord" } ], From 1678663f464a0b818752df62d2aaf4ada2a50277 Mon Sep 17 00:00:00 2001 From: MyDrift Date: Tue, 10 Dec 2024 23:53:56 +0100 Subject: [PATCH 6/6] added missing default states --- config/tweaks.json | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/config/tweaks.json b/config/tweaks.json index 0ebf1670..f54b7f38 100644 --- a/config/tweaks.json +++ b/config/tweaks.json @@ -3370,6 +3370,7 @@ "Name": "InitialKeyboardIndicators", "Value": "2", "OriginalValue": "0", + "DefaultState": "false", "Type": "DWord" }, { @@ -3377,6 +3378,7 @@ "Name": "InitialKeyboardIndicators", "Value": "2", "OriginalValue": "0", + "DefaultState": "false", "Type": "DWord" } ], @@ -3580,6 +3582,7 @@ "Name": "Hidden", "Value": "1", "OriginalValue": "0", + "DefaultState": "false", "Type": "DWord" } ], @@ -3608,6 +3611,7 @@ "Name": "HideFileExt", "Value": "0", "OriginalValue": "1", + "DefaultState": "false", "Type": "DWord" } ],