From 8eaa1a88029ef5e43283c289d0d2cc823fa42241 Mon Sep 17 00:00:00 2001 From: KonTy <9524513+KonTy@users.noreply.github.com> Date: Mon, 3 Jun 2024 18:53:39 -0700 Subject: [PATCH] Tweaks page overhaul: * Toggle page overhaul: * Modern toggles + Tweak: Disable Copilot + Tweak: Set hibernation to default (fix issue https://github.com/ChrisTitusTech/winutil/issues/1399) * Merge branch 'test-2024-04-20-2' into TweaksToggles --- config/themes.json | 3 ++ config/tweaks.json | 83 +++++++++++++++++++++++++++++++ functions/private/Get-TabXaml.ps1 | 5 +- xaml/inputXML.xaml | 78 ++++++++++++++++++++--------- 4 files changed, 142 insertions(+), 27 deletions(-) diff --git a/config/themes.json b/config/themes.json index fb23ca95..f61c09ef 100644 --- a/config/themes.json +++ b/config/themes.json @@ -23,6 +23,7 @@ "ButtonBackgroundMouseoverColor": "#C2C2C2", "ButtonBackgroundSelectedColor": "#F0F0F0", "ButtonForegroundColor": "#000000", + "ToggleButtonOnColor": "#2e77ff", "ButtonBorderThickness": "1", "ButtonMargin": "1", "ButtonCornerRadius": "2", @@ -53,6 +54,7 @@ "ButtonBackgroundMouseoverColor": "#A55A64", "ButtonBackgroundSelectedColor": "#FF5733", "ButtonForegroundColor": "#9CCC65", + "ToggleButtonOnColor": "#2e77ff", "ButtonBorderThickness": "1", "ButtonMargin": "1", "ButtonCornerRadius": "2", @@ -83,6 +85,7 @@ "ButtonBackgroundMouseoverColor": "#FF5733", "ButtonBackgroundSelectedColor": "#FF5733", "ButtonForegroundColor": "#9CCC65", + "ToggleButtonOnColor": "#2e77ff", "ButtonBorderThickness": "1", "ButtonMargin": "1", "ButtonCornerRadius": "2", diff --git a/config/tweaks.json b/config/tweaks.json index 8829b8a3..8ff735ee 100644 --- a/config/tweaks.json +++ b/config/tweaks.json @@ -58,6 +58,53 @@ "powercfg.exe /hibernate on" ] }, + "WPFToggleTweaksLaptopHybernation": { + "Content": "Set Hibernation as default (good for laptops)", + "Description": "Most modern laptops have connected stadby enabled which drains the battery, this sets hibernation as default which will not drain the battery. See issue https://github.com/ChrisTitusTech/winutil/issues/1399", + "category": "Essential Tweaks", + "panel": "1", + "Order": "a011_", + "registry": [ + { + "Path": "HKLM:\\SYSTEM\\CurrentControlSet\\Control\\Power\\PowerSettings\\238C9FA8-0AAD-41ED-83F4-97BE242C8F20\\7bc4a2f9-d8fc-4469-b07b-33eb785aaca0", + "OriginalValue": "1", + "Name": "Attributes", + "Value": "2", + "Type": "DWord" + }, + { + "Path": "HKLM:\\SYSTEM\\CurrentControlSet\\Control\\Power\\PowerSettings\\abfc2519-3608-4c2a-94ea-171b0ed546ab\\94ac6d29-73ce-41a6-809f-6363ba21b47e", + "OriginalValue": "0", + "Name": "Attributes ", + "Value": "2", + "Type": "DWord" + } + ], + "InvokeScript": [ + " + Write-Host \"Turn on Hibernation\" + Start-Process -FilePath powercfg -ArgumentList \"/hibernate on\" -NoNewWindow -Wait + + # Set hibernation as the default action + Start-Process -FilePath powercfg -ArgumentList \"/change standby-timeout-ac 60\" -NoNewWindow -Wait + Start-Process -FilePath powercfg -ArgumentList \"/change standby-timeout-dc 60\" -NoNewWindow -Wait + Start-Process -FilePath powercfg -ArgumentList \"/change monitor-timeout-ac 10\" -NoNewWindow -Wait + Start-Process -FilePath powercfg -ArgumentList \"/change monitor-timeout-dc 1\" -NoNewWindow -Wait + " + ], + "UndoScript": [ + " + Write-Host \"Turn off Hibernation\" + Start-Process -FilePath powercfg -ArgumentList \"/hibernate off\" -NoNewWindow -Wait + + # Set standby to detault values + Start-Process -FilePath powercfg -ArgumentList \"/change standby-timeout-ac 15\" -NoNewWindow -Wait + Start-Process -FilePath powercfg -ArgumentList \"/change standby-timeout-dc 15\" -NoNewWindow -Wait + Start-Process -FilePath powercfg -ArgumentList \"/change monitor-timeout-ac 15\" -NoNewWindow -Wait + Start-Process -FilePath powercfg -ArgumentList \"/change monitor-timeout-dc 15\" -NoNewWindow -Wait + " + ] + }, "WPFTweaksHome": { "Content": "Disable Homegroup", "Description": "Disables HomeGroup - HomeGroup is a password-protected home networking service that lets you share your stuff with other PCs that are currently running and connected to your network.", @@ -114,6 +161,42 @@ } ] }, + "WPFTweaksCopilotOff": { + "Content": "Disable Copilot", + "Description": "Copilot off", + "category": "Essential Tweaks", + "panel": "1", + "Order": "a011_", + "registry": [ + { + + "Path": "HKLM:\\SOFTWARE\\Policies\\Microsoft\\Windows\\WindowsCopilot", + "Name": "TurnOffWindowsCopilot", + "Type": "DWord", + "Value": "1", + "OriginalValue": "0p" + }, + { + "Path": "HKCU:\\Software\\Policies\\Microsoft\\Windows\\WindowsCopilot", + "Name": "TurnOffWindowsCopilot", + "Type": "DWord", + "Value": "1", + "OriginalValue": "0" + } + ], + "InvokeScript": [ + " + Write-Host \"Remove Popilot\" + dism /online /remove-package /package-name:Microsoft.Windows.Copilot + " + ], + "UndoScript": [ + " + Write-Host \"Why???\" + Write-Host \"Remove Popilot\" + " + ] + }, "WPFTweaksServices": { "Content": "Set Services to Manual", "Description": "Turns a bunch of system services to manual that don't need to be running all the time. This is pretty harmless as if the service is needed, it will simply start on demand.", diff --git a/functions/private/Get-TabXaml.ps1 b/functions/private/Get-TabXaml.ps1 index c4bccb9e..135039e1 100644 --- a/functions/private/Get-TabXaml.ps1 +++ b/functions/private/Get-TabXaml.ps1 @@ -91,9 +91,8 @@ function Get-TabXaml { } $appInfo = $organizedData[$panel][$category][$appName] if ("Toggle" -eq $appInfo.Type) { - $blockXml += "`n" - $blockXml += "`n" - $blockXml += "`n" + $blockXml += "`n`n" } elseif ("Combobox" -eq $appInfo.Type) { $blockXml += "`n