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
This commit is contained in:
KonTy 2024-06-03 18:53:39 -07:00 committed by GitHub
parent 9d874a6e2f
commit 8eaa1a8802
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
4 changed files with 142 additions and 27 deletions

View File

@ -23,6 +23,7 @@
"ButtonBackgroundMouseoverColor": "#C2C2C2", "ButtonBackgroundMouseoverColor": "#C2C2C2",
"ButtonBackgroundSelectedColor": "#F0F0F0", "ButtonBackgroundSelectedColor": "#F0F0F0",
"ButtonForegroundColor": "#000000", "ButtonForegroundColor": "#000000",
"ToggleButtonOnColor": "#2e77ff",
"ButtonBorderThickness": "1", "ButtonBorderThickness": "1",
"ButtonMargin": "1", "ButtonMargin": "1",
"ButtonCornerRadius": "2", "ButtonCornerRadius": "2",
@ -53,6 +54,7 @@
"ButtonBackgroundMouseoverColor": "#A55A64", "ButtonBackgroundMouseoverColor": "#A55A64",
"ButtonBackgroundSelectedColor": "#FF5733", "ButtonBackgroundSelectedColor": "#FF5733",
"ButtonForegroundColor": "#9CCC65", "ButtonForegroundColor": "#9CCC65",
"ToggleButtonOnColor": "#2e77ff",
"ButtonBorderThickness": "1", "ButtonBorderThickness": "1",
"ButtonMargin": "1", "ButtonMargin": "1",
"ButtonCornerRadius": "2", "ButtonCornerRadius": "2",
@ -83,6 +85,7 @@
"ButtonBackgroundMouseoverColor": "#FF5733", "ButtonBackgroundMouseoverColor": "#FF5733",
"ButtonBackgroundSelectedColor": "#FF5733", "ButtonBackgroundSelectedColor": "#FF5733",
"ButtonForegroundColor": "#9CCC65", "ButtonForegroundColor": "#9CCC65",
"ToggleButtonOnColor": "#2e77ff",
"ButtonBorderThickness": "1", "ButtonBorderThickness": "1",
"ButtonMargin": "1", "ButtonMargin": "1",
"ButtonCornerRadius": "2", "ButtonCornerRadius": "2",

View File

@ -58,6 +58,53 @@
"powercfg.exe /hibernate on" "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": { "WPFTweaksHome": {
"Content": "Disable Homegroup", "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.", "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": { "WPFTweaksServices": {
"Content": "Set Services to Manual", "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.", "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.",

View File

@ -91,9 +91,8 @@ function Get-TabXaml {
} }
$appInfo = $organizedData[$panel][$category][$appName] $appInfo = $organizedData[$panel][$category][$appName]
if ("Toggle" -eq $appInfo.Type) { if ("Toggle" -eq $appInfo.Type) {
$blockXml += "<StackPanel Orientation=`"Horizontal`" Margin=`"0,10,0,0`">`n" $blockXml += "<DockPanel LastChildFill=`"True`">`n<Label Content=`"$($appInfo.Content)`" ToolTip=`"$($appInfo.Description)`" HorizontalAlignment=`"Left`"/>`n"
$blockXml += "<CheckBox Name=`"$($appInfo.Name)`" Style=`"{StaticResource ColorfulToggleSwitchStyle}`" Margin=`"2.5,0`"/>`n" $blockXml += "<CheckBox Name=`"$($appInfo.Name)`" Style=`"{StaticResource ColorfulToggleSwitchStyle}`" Margin=`"2.5,0`" HorizontalAlignment=`"Right`"/>`n</DockPanel>`n"
$blockXml += "<Label Content=`"$($appInfo.Content)`" Style=`"{StaticResource labelfortweaks}`" ToolTip=`"$($appInfo.Description)`" />`n</StackPanel>`n"
} elseif ("Combobox" -eq $appInfo.Type) { } elseif ("Combobox" -eq $appInfo.Type) {
$blockXml += "<StackPanel Orientation=`"Horizontal`" Margin=`"0,5,0,0`">`n<Label Content=`"$($appInfo.Content)`" HorizontalAlignment=`"Left`" VerticalAlignment=`"Center`"/>`n" $blockXml += "<StackPanel Orientation=`"Horizontal`" Margin=`"0,5,0,0`">`n<Label Content=`"$($appInfo.Content)`" HorizontalAlignment=`"Left`" VerticalAlignment=`"Center`"/>`n"
$blockXml += "<ComboBox Name=`"$($appInfo.Name)`" Height=`"32`" Width=`"186`" HorizontalAlignment=`"Left`" VerticalAlignment=`"Center`" Margin=`"5,5`">`n" $blockXml += "<ComboBox Name=`"$($appInfo.Name)`" Height=`"32`" Width=`"186`" HorizontalAlignment=`"Left`" VerticalAlignment=`"Center`" Margin=`"5,5`">`n"

View File

@ -408,41 +408,71 @@
<Setter Property="Template"> <Setter Property="Template">
<Setter.Value> <Setter.Value>
<ControlTemplate TargetType="{x:Type ToggleButton}"> <ControlTemplate TargetType="{x:Type ToggleButton}">
<Grid x:Name="toggleSwitch" Margin="10,0,0,0"> <Grid x:Name="toggleSwitch">
<Border x:Name="Border" CornerRadius="11"
Background="#FFFFFFFF" <Grid.ColumnDefinitions>
Width="50" Height="25"> <ColumnDefinition Width="Auto"/>
<Border.Effect> <ColumnDefinition Width="Auto"/>
<DropShadowEffect ShadowDepth="0.5" Direction="0" Opacity="0.3" /> </Grid.ColumnDefinitions>
</Border.Effect> <TextBlock Grid.Column="0" x:Name="txtToggle" VerticalAlignment="Center" FontWeight="DemiBold" Foreground="{MainForegroundColor}" FontSize="12">
<Ellipse x:Name="Ellipse" Fill="#FFFFFFFF" Stretch="Uniform" <TextBlock.Style>
Margin="2 2 2 1" <Style TargetType="TextBlock">
Stroke="Gray" StrokeThickness="0.2" <Setter Property="Text" Value="Off"/>
HorizontalAlignment="Left" Width="22"> <Setter Property="Margin" Value="4,0,4,0"/>
<Ellipse.Effect> <Style.Triggers>
<DropShadowEffect BlurRadius="10" ShadowDepth="1" Opacity="0.3" Direction="260" /> <DataTrigger Binding="{Binding RelativeSource={RelativeSource TemplatedParent}, Path=IsChecked}" Value="True">
</Ellipse.Effect> <Setter Property="Text" Value="On"/>
</Ellipse> </DataTrigger>
</Border> </Style.Triggers>
</Style>
</TextBlock.Style>
</TextBlock>
<Border Grid.Column="1" x:Name="Border" CornerRadius="8"
BorderThickness="1"
Width="34" Height="17">
<Ellipse x:Name="Ellipse" Fill="{MainForegroundColor}" Stretch="Uniform"
Margin="2,2,2,1"
HorizontalAlignment="Left" Width="12">
</Ellipse>
</Border>
</Grid> </Grid>
<ControlTemplate.Triggers> <ControlTemplate.Triggers>
<Trigger Property="IsMouseOver" Value="True">
<Setter TargetName="Border" Property="BorderBrush" Value="{MainForegroundColor}" />
<Setter TargetName="Border" Property="Background" Value="{LinkHoverForegroundColor}"/>
<Setter Property="Cursor" Value="Hand" />
<Setter Property="Panel.ZIndex" Value="1000"/>
</Trigger>
<Trigger Property="ToggleButton.IsChecked" Value="False"> <Trigger Property="ToggleButton.IsChecked" Value="False">
<Setter TargetName="Border" Property="Background" Value="#C2283B" /> <Setter TargetName="Border" Property="Background" Value="{MainBackgroundColor}" />
<Setter TargetName="Ellipse" Property="Margin" Value="2 2 2 1" /> <Setter TargetName="Border" Property="BorderBrush" Value="{MainForegroundColor}" />
<Setter TargetName="Ellipse" Property="Fill" Value="{MainForegroundColor}" />
</Trigger> </Trigger>
<Trigger Property="ToggleButton.IsChecked" Value="True"> <Trigger Property="ToggleButton.IsChecked" Value="True">
<Setter TargetName="Border" Property="Background" Value="{MainBackgroundColor}" />
<Setter TargetName="Border" Property="BorderBrush" Value="{MainForegroundColor}" />
<Setter TargetName="Ellipse" Property="Fill" Value="{MainForegroundColor}" />
<Trigger.EnterActions> <Trigger.EnterActions>
<BeginStoryboard> <BeginStoryboard>
<Storyboard> <Storyboard>
<ColorAnimation Storyboard.TargetName="Border" <ColorAnimation Storyboard.TargetName="Border"
Storyboard.TargetProperty="(Border.Background).(SolidColorBrush.Color)" Storyboard.TargetProperty="(Border.Background).(SolidColorBrush.Color)"
To="#34A543" Duration="0:0:0.1" /> To="{ToggleButtonOnColor}" Duration="0:0:0.1" />
<ColorAnimation Storyboard.TargetName="Border"
Storyboard.TargetProperty="(Border.BorderBrush).(SolidColorBrush.Color)"
To="{ToggleButtonOnColor}" Duration="0:0:0.1" />
<ColorAnimation Storyboard.TargetName="Ellipse"
Storyboard.TargetProperty="(Fill).(SolidColorBrush.Color)"
To="White" Duration="0:0:0.1" />
<ThicknessAnimation Storyboard.TargetName="Ellipse" <ThicknessAnimation Storyboard.TargetName="Ellipse"
Storyboard.TargetProperty="Margin" Storyboard.TargetProperty="Margin"
To="26 2 2 1" Duration="0:0:0.1" /> To="18,2,2,2" Duration="0:0:0.1" />
</Storyboard> </Storyboard>
</BeginStoryboard> </BeginStoryboard>
</Trigger.EnterActions> </Trigger.EnterActions>
@ -451,15 +481,15 @@
<Storyboard> <Storyboard>
<ColorAnimation Storyboard.TargetName="Border" <ColorAnimation Storyboard.TargetName="Border"
Storyboard.TargetProperty="(Border.Background).(SolidColorBrush.Color)" Storyboard.TargetProperty="(Border.Background).(SolidColorBrush.Color)"
To="#C2283B" Duration="0:0:0.1" /> To="{MainBackgroundColor}" Duration="0:0:0.1" />
<ThicknessAnimation Storyboard.TargetName="Ellipse" <ThicknessAnimation Storyboard.TargetName="Ellipse"
Storyboard.TargetProperty="Margin" Storyboard.TargetProperty="Margin"
To="2 2 2 1" Duration="0:0:0.1" /> To="2,2,2,1" Duration="0:0:0.1" />
</Storyboard> </Storyboard>
</BeginStoryboard> </BeginStoryboard>
</Trigger.ExitActions> </Trigger.ExitActions>
<Setter Property="Foreground" Value="{DynamicResource IdealForegroundColorBrush}" />
</Trigger> </Trigger>
</ControlTemplate.Triggers> </ControlTemplate.Triggers>
</ControlTemplate> </ControlTemplate>