Add New Toggle to Disable/Enable Widgets found in Taskbar

This commit is contained in:
Mr.k 2024-03-31 02:44:02 +03:00
parent 4a7c8a35bf
commit 1b0af32357
No known key found for this signature in database
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)}
}
}