diff --git a/config/tweaks.json b/config/tweaks.json index a4be4d14..0f1b7162 100644 --- a/config/tweaks.json +++ b/config/tweaks.json @@ -3114,5 +3114,13 @@ "panel": "2", "Order": "a082_", "Type": "300" + }, + "WPFToggleTaskView": { + "Content": "Task View", + "Description": "If Enabled then Task View Icon in Taskbar will be shown.", + "category": "Customize Preferences", + "panel": "2", + "Order": "a069_", + "Type": "Toggle" } } diff --git a/functions/private/Get-WinUtilToggleStatus.ps1 b/functions/private/Get-WinUtilToggleStatus.ps1 index d3469c94..249b4541 100644 --- a/functions/private/Get-WinUtilToggleStatus.ps1 +++ b/functions/private/Get-WinUtilToggleStatus.ps1 @@ -116,6 +116,15 @@ Function Get-WinUtilToggleStatus { return $true } } + if ($ToggleSwitch -eq "WPFToggleTaskView") { + $TaskView = (Get-ItemProperty -path 'HKCU:\Software\Microsoft\Windows\CurrentVersion\Explorer\Advanced').ShowTaskViewButton + if($TaskView -eq 0){ + return $false + } + else{ + return $true + } + } if ($ToggleSwitch -eq "WPFToggleTaskbarWidgets") { $TaskbarWidgets = (Get-ItemProperty -Path "HKCU:\Software\Microsoft\Windows\CurrentVersion\Explorer\Advanced").TaskBarDa if($TaskbarWidgets -eq 0) { diff --git a/functions/private/Invoke-WinUtilTaskView.ps1 b/functions/private/Invoke-WinUtilTaskView.ps1 new file mode 100644 index 00000000..b9963294 --- /dev/null +++ b/functions/private/Invoke-WinUtilTaskView.ps1 @@ -0,0 +1,34 @@ +function Invoke-WinUtilTaskView { + <# + + .SYNOPSIS + Enable/Disable Task View + + .PARAMETER Enabled + Indicates whether to enable or disable Task View + + #> + Param($Enabled) + Try{ + if ($Enabled -eq $false){ + Write-Host "Enabling Task View" + $value = 1 + } + else { + Write-Host "Disabling Task View" + $value = 0 + } + $Path = "HKCU:\Software\Microsoft\Windows\CurrentVersion\Explorer\Advanced" + Set-ItemProperty -Path $Path -Name ShowTaskViewButton -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 5e65f86e..9d923edb 100644 --- a/functions/public/Invoke-WPFToggle.ps1 +++ b/functions/public/Invoke-WPFToggle.ps1 @@ -29,5 +29,6 @@ function Invoke-WPFToggle { "WPFToggleStickyKeys" {Invoke-WinUtilStickyKeys $(Get-WinUtilToggleStatus WPFToggleStickyKeys)} "WPFToggleTaskbarWidgets" {Invoke-WinUtilTaskbarWidgets $(Get-WinUtilToggleStatus WPFToggleTaskbarWidgets)} "WPFToggleTaskbarSearch" {Invoke-WinUtilTaskbarSearch $(Get-WinUtilToggleStatus WPFToggleTaskbarSearch)} + "WPFToggleTaskView" {Invoke-WinUtilTaskView $(Get-WinUtilToggleStatus WPFToggleTaskView)} } }