Skip to content

Commit

Permalink
[FEAT] TweakToggles logik overhaul (#3014)
Browse files Browse the repository at this point in the history
* move logic to json template

- remove Invoke-WPFToggle.ps1
- generalize Get-WinUtilToggleStatus
- add bingsearch reg key for testing
- use Invoke-WinUtilTweaks for actions
- replace Add-Click with checked & unchecked to make undo work

* add reg params for toggles into tweaks.json

- add all reg keys to tweaks.json into existing toggle entry
- remove unneeded scripts

* fix HKU

- load HKU if needed (for tweaks & GetToggleStatus)
- remove unneeded Invoke-WinUtilNumLock
- has loaded HKU does not load/not stay loaded

* add a lot of error handling

* Bugfix: New-PSDrive seems to return the "hku" itself so weirdly gets prepended to the return value so the result becomes ("hku", $false). In powershell pretty much every variable that exists is interpreted as $true so the toggle for numlock got incorrectly checked

* globally fix HKU error & minimize console feedback

- fix HKU issue globally
- remove some console logs, change some others to write-debug

* update Explorerrefresh

- change Invoke-WinUtilExplorerRefresh to handle refresh and restart
- add restart logic to window snapping Flyout & Suggestions
- rename Invoke-WinUtilExplorerRefresh to Invoke-WinUtilExplorerUpdate

* add explorer restart where needed to take effect

add explorer restart logic for hidden files + Fileextension toggles

* fix missing theme change logic in darkmode toggle

* fix window snapping

- fix issue defining WindowArrangementActive as dword instead of string

* fix bing search

- switch bing search enabled/disabled values

* add a little bit of error handling

- add error handling for Get-WinUtilToggleStatus

---------

Co-authored-by: Marterich <[email protected]>
  • Loading branch information
MyDrift-user and Marterich authored Dec 6, 2024
1 parent 83450ae commit 1d0e3bf
Show file tree
Hide file tree
Showing 24 changed files with 341 additions and 633 deletions.
235 changes: 235 additions & 0 deletions config/tweaks.json
Original file line number Diff line number Diff line change
Expand Up @@ -3302,6 +3302,38 @@
"panel": "2",
"Order": "a100_",
"Type": "Toggle",
"registry": [
{
"Path": "HKCU:\\SOFTWARE\\Microsoft\\Windows\\CurrentVersion\\Themes\\Personalize",
"Name": "AppsUseLightTheme",
"Value": "0",
"OriginalValue": "1",
"Type": "DWord"
},
{
"Path": "HKCU:\\SOFTWARE\\Microsoft\\Windows\\CurrentVersion\\Themes\\Personalize",
"Name": "SystemUsesLightTheme",
"Value": "0",
"OriginalValue": "1",
"Type": "DWord"
}
],
"InvokeScript": [
"
Invoke-WinUtilExplorerUpdate
if ($sync.ThemeButton.Content -eq [char]0xF08C) {
Invoke-WinutilThemeChange -theme \"Auto\"
}
"
],
"UndoScript": [
"
Invoke-WinUtilExplorerUpdate
if ($sync.ThemeButton.Content -eq [char]0xF08C) {
Invoke-WinutilThemeChange -theme \"Auto\"
}
"
],
"link": "https://christitustech.github.io/winutil/dev/tweaks/Customize-Preferences/DarkMode"
},
"WPFToggleBingSearch": {
Expand All @@ -3311,6 +3343,15 @@
"panel": "2",
"Order": "a101_",
"Type": "Toggle",
"registry": [
{
"Path": "HKCU:\\Software\\Microsoft\\Windows\\CurrentVersion\\Search",
"Name": "BingSearchEnabled",
"Value": "1",
"OriginalValue": "0",
"Type": "DWord"
}
],
"link": "https://christitustech.github.io/winutil/dev/tweaks/Customize-Preferences/BingSearch"
},
"WPFToggleNumLock": {
Expand All @@ -3320,6 +3361,22 @@
"panel": "2",
"Order": "a102_",
"Type": "Toggle",
"registry": [
{
"Path": "HKU:\\.Default\\Control Panel\\Keyboard",
"Name": "InitialKeyboardIndicators",
"Value": "2",
"OriginalValue": "0",
"Type": "DWord"
},
{
"Path": "HKCU:\\Control Panel\\Keyboard",
"Name": "InitialKeyboardIndicators",
"Value": "2",
"OriginalValue": "0",
"Type": "DWord"
}
],
"link": "https://christitustech.github.io/winutil/dev/tweaks/Customize-Preferences/NumLock"
},
"WPFToggleVerboseLogon": {
Expand All @@ -3329,6 +3386,15 @@
"panel": "2",
"Order": "a103_",
"Type": "Toggle",
"registry": [
{
"Path": "HKLM:\\SOFTWARE\\Microsoft\\Windows\\CurrentVersion\\Policies\\System",
"Name": "VerboseStatus",
"Value": "1",
"OriginalValue": "0",
"Type": "DWord"
}
],
"link": "https://christitustech.github.io/winutil/dev/tweaks/Customize-Preferences/VerboseLogon"
},
"WPFToggleSnapWindow": {
Expand All @@ -3338,6 +3404,15 @@
"panel": "2",
"Order": "a104_",
"Type": "Toggle",
"registry": [
{
"Path": "HKCU:\\Control Panel\\Desktop",
"Name": "WindowArrangementActive",
"Value": "1",
"OriginalValue": "0",
"Type": "String"
}
],
"link": "https://christitustech.github.io/winutil/dev/tweaks/Customize-Preferences/SnapWindow"
},
"WPFToggleSnapFlyout": {
Expand All @@ -3347,6 +3422,25 @@
"panel": "2",
"Order": "a105_",
"Type": "Toggle",
"registry": [
{
"Path": "HKCU:\\Software\\Microsoft\\Windows\\CurrentVersion\\Explorer\\Advanced",
"Name": "EnableSnapAssistFlyout",
"Value": "1",
"OriginalValue": "0",
"Type": "DWord"
}
],
"InvokeScript": [
"
Invoke-WinUtilExplorerUpdate -action \"restart\"
"
],
"UndoScript": [
"
Invoke-WinUtilExplorerUpdate -action \"restart\"
"
],
"link": "https://christitustech.github.io/winutil/dev/tweaks/Customize-Preferences/SnapFlyout"
},
"WPFToggleSnapSuggestion": {
Expand All @@ -3356,6 +3450,25 @@
"panel": "2",
"Order": "a106_",
"Type": "Toggle",
"registry": [
{
"Path": "HKCU:\\Software\\Microsoft\\Windows\\CurrentVersion\\Explorer\\Advanced",
"Name": "SnapAssist",
"Value": "1",
"OriginalValue": "0",
"Type": "DWord"
}
],
"InvokeScript": [
"
Invoke-WinUtilExplorerUpdate -action \"restart\"
"
],
"UndoScript": [
"
Invoke-WinUtilExplorerUpdate -action \"restart\"
"
],
"link": "https://christitustech.github.io/winutil/dev/tweaks/Customize-Preferences/SnapSuggestion"
},
"WPFToggleMouseAcceleration": {
Expand All @@ -3365,6 +3478,29 @@
"panel": "2",
"Order": "a107_",
"Type": "Toggle",
"registry": [
{
"Path": "HKCU:\\Control Panel\\Mouse",
"Name": "MouseSpeed",
"Value": "1",
"OriginalValue": "0",
"Type": "DWord"
},
{
"Path": "HKCU:\\Control Panel\\Mouse",
"Name": "MouseThreshold1",
"Value": "6",
"OriginalValue": "0",
"Type": "DWord"
},
{
"Path": "HKCU:\\Control Panel\\Mouse",
"Name": "MouseThreshold2",
"Value": "10",
"OriginalValue": "0",
"Type": "DWord"
}
],
"link": "https://christitustech.github.io/winutil/dev/tweaks/Customize-Preferences/MouseAcceleration"
},
"WPFToggleStickyKeys": {
Expand All @@ -3374,6 +3510,15 @@
"panel": "2",
"Order": "a108_",
"Type": "Toggle",
"registry": [
{
"Path": "HKCU:\\Control Panel\\Accessibility\\StickyKeys",
"Name": "Flags",
"Value": "510",
"OriginalValue": "58",
"Type": "DWord"
}
],
"link": "https://christitustech.github.io/winutil/dev/tweaks/Customize-Preferences/StickyKeys"
},
"WPFToggleHiddenFiles": {
Expand All @@ -3383,6 +3528,25 @@
"panel": "2",
"Order": "a200_",
"Type": "Toggle",
"registry": [
{
"Path": "HKCU:\\Software\\Microsoft\\Windows\\CurrentVersion\\Explorer\\Advanced",
"Name": "Hidden",
"Value": "1",
"OriginalValue": "0",
"Type": "DWord"
}
],
"InvokeScript": [
"
Invoke-WinUtilExplorerUpdate -action \"restart\"
"
],
"UndoScript": [
"
Invoke-WinUtilExplorerUpdate -action \"restart\"
"
],
"link": "https://christitustech.github.io/winutil/dev/tweaks/Customize-Preferences/HiddenFiles"
},
"WPFToggleShowExt": {
Expand All @@ -3392,6 +3556,25 @@
"panel": "2",
"Order": "a201_",
"Type": "Toggle",
"registry": [
{
"Path": "HKCU:\\Software\\Microsoft\\Windows\\CurrentVersion\\Explorer\\Advanced",
"Name": "HideFileExt",
"Value": "0",
"OriginalValue": "1",
"Type": "DWord"
}
],
"InvokeScript": [
"
Invoke-WinUtilExplorerUpdate -action \"restart\"
"
],
"UndoScript": [
"
Invoke-WinUtilExplorerUpdate -action \"restart\"
"
],
"link": "https://christitustech.github.io/winutil/dev/tweaks/Customize-Preferences/ShowExt"
},
"WPFToggleTaskbarSearch": {
Expand All @@ -3401,6 +3584,15 @@
"panel": "2",
"Order": "a202_",
"Type": "Toggle",
"registry": [
{
"Path": "HKCU:\\Software\\Microsoft\\Windows\\CurrentVersion\\Search",
"Name": "SearchboxTaskbarMode",
"Value": "1",
"OriginalValue": "0",
"Type": "DWord"
}
],
"link": "https://christitustech.github.io/winutil/dev/tweaks/Customize-Preferences/TaskbarSearch"
},
"WPFToggleTaskView": {
Expand All @@ -3410,6 +3602,15 @@
"panel": "2",
"Order": "a203_",
"Type": "Toggle",
"registry": [
{
"Path": "HKCU:\\Software\\Microsoft\\Windows\\CurrentVersion\\Explorer\\Advanced",
"Name": "ShowTaskViewButton",
"Value": "1",
"OriginalValue": "0",
"Type": "DWord"
}
],
"link": "https://christitustech.github.io/winutil/dev/tweaks/Customize-Preferences/TaskView"
},
"WPFToggleTaskbarWidgets": {
Expand All @@ -3419,6 +3620,15 @@
"panel": "2",
"Order": "a204_",
"Type": "Toggle",
"registry": [
{
"Path": "HKCU:\\Software\\Microsoft\\Windows\\CurrentVersion\\Explorer\\Advanced",
"Name": "TaskbarDa",
"Value": "1",
"OriginalValue": "0",
"Type": "DWord"
}
],
"link": "https://christitustech.github.io/winutil/dev/tweaks/Customize-Preferences/TaskbarWidgets"
},
"WPFToggleTaskbarAlignment": {
Expand All @@ -3428,6 +3638,15 @@
"panel": "2",
"Order": "a204_",
"Type": "Toggle",
"registry": [
{
"Path": "HKCU:\\Software\\Microsoft\\Windows\\CurrentVersion\\Explorer\\Advanced",
"Name": "TaskbarAl",
"Value": "1",
"OriginalValue": "0",
"Type": "DWord"
}
],
"link": "https://christitustech.github.io/winutil/dev/tweaks/Customize-Preferences/TaskbarAlignment"
},
"WPFToggleDetailedBSoD": {
Expand All @@ -3437,6 +3656,22 @@
"panel": "2",
"Order": "a205_",
"Type": "Toggle",
"registry": [
{
"Path": "HKLM:\\SYSTEM\\CurrentControlSet\\Control\\CrashControl",
"Name": "DisplayParameters",
"Value": "1",
"OriginalValue": "0",
"Type": "DWord"
},
{
"Path": "HKLM:\\SYSTEM\\CurrentControlSet\\Control\\CrashControl",
"Name": "DisableEmoticon",
"Value": "1",
"OriginalValue": "0",
"Type": "DWord"
}
],
"link": "https://christitustech.github.io/winutil/dev/tweaks/Customize-Preferences/DetailedBSoD"
},
"WPFOOSUbutton": {
Expand Down
Loading

0 comments on commit 1d0e3bf

Please sign in to comment.