diff --git a/config/tweaks.json b/config/tweaks.json index 4af9dc79..ccdfe0e4 100644 --- a/config/tweaks.json +++ b/config/tweaks.json @@ -3141,5 +3141,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 95499ef1..9e4b6bd3 100644 --- a/functions/private/Get-WinUtilToggleStatus.ps1 +++ b/functions/private/Get-WinUtilToggleStatus.ps1 @@ -107,6 +107,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 a3c94875..b631b782 100644 --- a/functions/public/Invoke-WPFToggle.ps1 +++ b/functions/public/Invoke-WPFToggle.ps1 @@ -28,5 +28,6 @@ function Invoke-WPFToggle { "WPFToggleMouseAcceleration" {Invoke-WinUtilMouseAcceleration $(Get-WinUtilToggleStatus WPFToggleMouseAcceleration)} "WPFToggleStickyKeys" {Invoke-WinUtilStickyKeys $(Get-WinUtilToggleStatus WPFToggleStickyKeys)} "WPFToggleTaskbarWidgets" {Invoke-WinUtilTaskbarWidgets $(Get-WinUtilToggleStatus WPFToggleTaskbarWidgets)} + "WPFToggleTaskView" {Invoke-WinUtilTaskView $(Get-WinUtilToggleStatus WPFToggleTaskView)} } }