Add New Toggle to Disable/Enable Widgets found in Taskbar (#1768)

This commit is contained in:
Mr.k 2024-03-31 20:07:36 +03:00 committed by GitHub
parent 07abbba938
commit 25ce9df16f
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
4 changed files with 54 additions and 2 deletions

View File

@ -2613,6 +2613,14 @@
"Order": "a067_",
"Type": "Toggle"
},
"WPFToggleTaskbarWidgets": {
"Content": "Taskbar Widgets",
"Description": "If Enabled then Widgets Icon in Taskbar will be shown.",
"category": "Customize Preferences",
"panel": "2",
"Order": "a068_",
"Type": "Toggle"
},
"WPFchangedns": {
"Content": "DNS",
"category": "z__Advanced Tweaks - CAUTION",

View File

@ -89,4 +89,13 @@ Function Get-WinUtilToggleStatus {
return $true
}
}
}
if ($ToggleSwitch -eq "WPFToggleTaskbarWidgets") {
$TaskbarWidgets = (Get-ItemProperty -Path "HKCU:\Software\Microsoft\Windows\CurrentVersion\Explorer\Advanced").TaskBarDa
if($TaskbarWidgets -eq 0) {
return $false
}
else{
return $true
}
}
}

View File

@ -0,0 +1,34 @@
function Invoke-WinUtilTaskbarWidgets {
<#
.SYNOPSIS
Enable/Disable Taskbar Widgets
.PARAMETER Enabled
Indicates whether to enable or disable Taskbar Widgets
#>
Param($Enabled)
Try{
if ($Enabled -eq $false){
Write-Host "Enabling Taskbar Widgets"
$value = 1
}
else {
Write-Host "Disabling Taskbar Widgets"
$value = 0
}
$Path = "HKCU:\Software\Microsoft\Windows\CurrentVersion\Explorer\Advanced"
Set-ItemProperty -Path $Path -Name TaskbarDa -Value $value
}
Catch [System.Security.SecurityException] {
Write-Warning "Unable to set $Path\$Name to $Value due to a Security Exception"
}
Catch [System.Management.Automation.ItemNotFoundException] {
Write-Warning $psitem.Exception.ErrorRecord
}
Catch{
Write-Warning "Unable to set $Name due to unhandled exception"
Write-Warning $psitem.Exception.StackTrace
}
}

View File

@ -25,5 +25,6 @@ function Invoke-WPFToggle {
"WPFToggleSnapFlyout" {Invoke-WinUtilSnapFlyout $(Get-WinUtilToggleStatus WPFToggleSnapFlyout)}
"WPFToggleMouseAcceleration" {Invoke-WinUtilMouseAcceleration $(Get-WinUtilToggleStatus WPFToggleMouseAcceleration)}
"WPFToggleStickyKeys" {Invoke-WinUtilStickyKeys $(Get-WinUtilToggleStatus WPFToggleStickyKeys)}
"WPFToggleTaskbarWidgets" {Invoke-WinUtilTaskbarWidgets $(Get-WinUtilToggleStatus WPFToggleTaskbarWidgets)}
}
}
}