diff --git a/config/tweaks.json b/config/tweaks.json index cd074d65..445b7477 100644 --- a/config/tweaks.json +++ b/config/tweaks.json @@ -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", diff --git a/functions/private/Get-WinUtilToggleStatus.ps1 b/functions/private/Get-WinUtilToggleStatus.ps1 index cc5b5090..95160ef6 100644 --- a/functions/private/Get-WinUtilToggleStatus.ps1 +++ b/functions/private/Get-WinUtilToggleStatus.ps1 @@ -89,4 +89,13 @@ Function Get-WinUtilToggleStatus { return $true } } -} \ No newline at end of file + 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 + } + } +} diff --git a/functions/private/Invoke-WinUtilTaskbarWidgets.ps1 b/functions/private/Invoke-WinUtilTaskbarWidgets.ps1 new file mode 100644 index 00000000..27077f55 --- /dev/null +++ b/functions/private/Invoke-WinUtilTaskbarWidgets.ps1 @@ -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 + } +} diff --git a/functions/public/Invoke-WPFToggle.ps1 b/functions/public/Invoke-WPFToggle.ps1 index 1a60217e..fd8a82f4 100644 --- a/functions/public/Invoke-WPFToggle.ps1 +++ b/functions/public/Invoke-WPFToggle.ps1 @@ -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)} } -} \ No newline at end of file +}