mirror of
https://github.com/ChrisTitusTech/winutil
synced 2026-04-05 22:28:31 +00:00
@@ -1,23 +0,0 @@
|
||||
function Invoke-WinUtilGPU {
|
||||
$gpuInfo = Get-CimInstance Win32_VideoController
|
||||
|
||||
# GPUs to blacklist from using Demanding Theming
|
||||
$lowPowerGPUs = (
|
||||
"*NVIDIA GeForce*M*",
|
||||
"*NVIDIA GeForce*Laptop*",
|
||||
"*NVIDIA GeForce*GT*",
|
||||
"*AMD Radeon(TM)*",
|
||||
"*Intel(R) HD Graphics*",
|
||||
"*UHD*"
|
||||
|
||||
)
|
||||
|
||||
foreach ($gpu in $gpuInfo) {
|
||||
foreach ($gpuPattern in $lowPowerGPUs) {
|
||||
if ($gpu.Name -like $gpuPattern) {
|
||||
return $false
|
||||
}
|
||||
}
|
||||
}
|
||||
return $true
|
||||
}
|
||||
@@ -18,6 +18,31 @@ function Invoke-WPFButton {
|
||||
Set-WinUtilProgressBar -label "" -percent 0
|
||||
}
|
||||
|
||||
# Check if button is defined in feature config with function or InvokeScript
|
||||
if ($sync.configs.feature.$Button) {
|
||||
$buttonConfig = $sync.configs.feature.$Button
|
||||
|
||||
# If button has a function defined, call it
|
||||
if ($buttonConfig.function) {
|
||||
$functionName = $buttonConfig.function
|
||||
if (Get-Command $functionName -ErrorAction SilentlyContinue) {
|
||||
& $functionName
|
||||
return
|
||||
}
|
||||
}
|
||||
|
||||
# If button has InvokeScript defined, execute the scripts
|
||||
if ($buttonConfig.InvokeScript -and $buttonConfig.InvokeScript.Count -gt 0) {
|
||||
foreach ($script in $buttonConfig.InvokeScript) {
|
||||
if (-not [string]::IsNullOrWhiteSpace($script)) {
|
||||
Invoke-Expression $script
|
||||
}
|
||||
}
|
||||
return
|
||||
}
|
||||
}
|
||||
|
||||
# Fallback to hard-coded switch for buttons not in feature.json
|
||||
Switch -Wildcard ($Button) {
|
||||
"WPFTab?BT" {Invoke-WPFTab $Button}
|
||||
"WPFInstall" {Invoke-WPFInstall}
|
||||
@@ -34,34 +59,14 @@ function Invoke-WPFButton {
|
||||
"WPFAddUltPerf" {Invoke-WPFUltimatePerformance -State "Enable"}
|
||||
"WPFRemoveUltPerf" {Invoke-WPFUltimatePerformance -State "Disable"}
|
||||
"WPFundoall" {Invoke-WPFundoall}
|
||||
"WPFFeatureInstall" {Invoke-WPFFeatureInstall}
|
||||
"WPFPanelDISM" {Invoke-WPFSystemRepair}
|
||||
"WPFPanelAutologin" {Invoke-WPFPanelAutologin}
|
||||
"WPFPanelComputer" {Invoke-WPFControlPanel -Panel $button}
|
||||
"WPFPanelControl" {Invoke-WPFControlPanel -Panel $button}
|
||||
"WPFPanelNetwork" {Invoke-WPFControlPanel -Panel $button}
|
||||
"WPFPanelPower" {Invoke-WPFControlPanel -Panel $button}
|
||||
"WPFPanelPrinter" {Invoke-WPFControlPanel -Panel $button}
|
||||
"WPFPanelRegion" {Invoke-WPFControlPanel -Panel $button}
|
||||
"WPFPanelRestore" {Invoke-WPFControlPanel -Panel $button}
|
||||
"WPFPanelSound" {Invoke-WPFControlPanel -Panel $button}
|
||||
"WPFPanelSystem" {Invoke-WPFControlPanel -Panel $button}
|
||||
"WPFPanelTimedate" {Invoke-WPFControlPanel -Panel $button}
|
||||
"WPFPanelUser" {Invoke-WPFControlPanel -Panel $button}
|
||||
"WPFUpdatesdefault" {Invoke-WPFUpdatesdefault}
|
||||
"WPFFixesUpdate" {Invoke-WPFFixesUpdate}
|
||||
"WPFFixesWinget" {Invoke-WPFFixesWinget}
|
||||
"WPFRunAdobeCCCleanerTool" {Invoke-WPFRunAdobeCCCleanerTool}
|
||||
"WPFFixesNetwork" {Invoke-WPFFixesNetwork}
|
||||
"WPFUpdatesdisable" {Invoke-WPFUpdatesdisable}
|
||||
"WPFUpdatessecurity" {Invoke-WPFUpdatessecurity}
|
||||
"WPFWinUtilShortcut" {Invoke-WPFShortcut -ShortcutToAdd "WinUtil" -RunAsAdmin $true}
|
||||
"WPFGetInstalled" {Invoke-WPFGetInstalled -CheckBox "winget"}
|
||||
"WPFGetInstalledTweaks" {Invoke-WPFGetInstalled -CheckBox "tweaks"}
|
||||
"WPFCloseButton" {Invoke-WPFCloseButton}
|
||||
"WPFWinUtilInstallPSProfile" {Invoke-WinUtilInstallPSProfile}
|
||||
"WPFWinUtilUninstallPSProfile" {Invoke-WinUtilUninstallPSProfile}
|
||||
"WPFWinUtilSSHServer" {Invoke-WPFSSHServer}
|
||||
"WPFCloseButton" {$sync.Form.Close(); Write-Host "Bye bye!"}
|
||||
"WPFselectedAppsButton" {$sync.selectedAppsPopup.IsOpen = -not $sync.selectedAppsPopup.IsOpen}
|
||||
"WPFToggleFOSSHighlight" {
|
||||
if ($sync.WPFToggleFOSSHighlight.IsChecked) {
|
||||
|
||||
@@ -1,12 +0,0 @@
|
||||
function Invoke-WPFCloseButton {
|
||||
|
||||
<#
|
||||
|
||||
.SYNOPSIS
|
||||
Close application
|
||||
|
||||
.PARAMETER Button
|
||||
#>
|
||||
$sync["Form"].Close()
|
||||
Write-Host "Bye bye!"
|
||||
}
|
||||
@@ -1,26 +0,0 @@
|
||||
function Invoke-WPFControlPanel {
|
||||
<#
|
||||
|
||||
.SYNOPSIS
|
||||
Opens the requested legacy panel
|
||||
|
||||
.PARAMETER Panel
|
||||
The panel to open
|
||||
|
||||
#>
|
||||
param($Panel)
|
||||
|
||||
switch ($Panel) {
|
||||
"WPFPanelControl" {control}
|
||||
"WPFPanelComputer" {compmgmt.msc}
|
||||
"WPFPanelNetwork" {ncpa.cpl}
|
||||
"WPFPanelPower" {powercfg.cpl}
|
||||
"WPFPanelPrinter" {Start-Process "shell:::{A8A91A66-3A7D-4424-8D24-04E180695C7A}"}
|
||||
"WPFPanelRegion" {intl.cpl}
|
||||
"WPFPanelRestore" {rstrui.exe}
|
||||
"WPFPanelSound" {mmsys.cpl}
|
||||
"WPFPanelSystem" {sysdm.cpl}
|
||||
"WPFPanelTimedate" {timedate.cpl}
|
||||
"WPFPanelUser" {control userpasswords2}
|
||||
}
|
||||
}
|
||||
@@ -180,7 +180,7 @@ function Invoke-WPFUIElements {
|
||||
if ($entryInfo.Checked -eq $true) {
|
||||
$sync[$entryInfo.Name].IsChecked = $true
|
||||
}
|
||||
|
||||
|
||||
$sync[$entryInfo.Name].Add_Checked({
|
||||
Invoke-WPFButton -Button "WPFToggleFOSSHighlight"
|
||||
})
|
||||
@@ -189,13 +189,13 @@ function Invoke-WPFUIElements {
|
||||
})
|
||||
} else {
|
||||
$sync[$entryInfo.Name].IsChecked = (Get-WinUtilToggleStatus $entryInfo.Name)
|
||||
|
||||
|
||||
$sync[$entryInfo.Name].Add_Checked({
|
||||
[System.Object]$Sender = $args[0]
|
||||
Invoke-WPFSelectedCheckboxesUpdate -type "Add" -checkboxName $Sender.name
|
||||
Invoke-WinUtilTweaks $Sender.name
|
||||
})
|
||||
|
||||
|
||||
$sync[$entryInfo.Name].Add_Unchecked({
|
||||
[System.Object]$Sender = $args[0]
|
||||
Invoke-WPFSelectedCheckboxesUpdate -type "Remove" -checkboxName $Sender.name
|
||||
|
||||
Reference in New Issue
Block a user