mirror of
https://github.com/ChrisTitusTech/winutil.git
synced 2024-12-29 01:11:30 -06:00
Add New Toggle to Disable/Enable Widgets found in Taskbar (#1768)
This commit is contained in:
parent
07abbba938
commit
25ce9df16f
@ -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",
|
||||
|
@ -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
|
||||
}
|
||||
}
|
||||
}
|
||||
|
34
functions/private/Invoke-WinUtilTaskbarWidgets.ps1
Normal file
34
functions/private/Invoke-WinUtilTaskbarWidgets.ps1
Normal 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
|
||||
}
|
||||
}
|
@ -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)}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user