Skip to content

Commit

Permalink
Add New Toggle to Disable/Enable Widgets found in Taskbar
Browse files Browse the repository at this point in the history
  • Loading branch information
og-mrk committed Mar 30, 2024
1 parent 4a7c8a3 commit 9220b23
Show file tree
Hide file tree
Showing 4 changed files with 54 additions and 2 deletions.
8 changes: 8 additions & 0 deletions config/tweaks.json
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand Down
11 changes: 10 additions & 1 deletion functions/private/Get-WinUtilToggleStatus.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -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 changes: 34 additions & 0 deletions functions/private/Invoke-WinUtilTaskbarWidgets.ps1
Original file line number Diff line number Diff line change
@@ -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
}
}
3 changes: 2 additions & 1 deletion functions/public/Invoke-WPFToggle.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -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)}
}
}
}

0 comments on commit 9220b23

Please sign in to comment.