diff --git a/config/tweaks.json b/config/tweaks.json index afae0216..80c4c680 100644 --- a/config/tweaks.json +++ b/config/tweaks.json @@ -3067,12 +3067,20 @@ "Order": "a108_", "Type": "Toggle" }, + "WPFToggleHiddenFiles": { + "Content": "Show Hidden Files", + "Description": "If Enabled then Hidden Files will be shown.", + "category": "Customize Preferences", + "panel": "2", + "Order": "a200_", + "Type": "Toggle" + }, "WPFToggleShowExt": { "Content": "Show File Extensions", "Description": "If enabled then File extensions (e.g., .txt, .jpg) are visible.", "category": "Customize Preferences", "panel": "2", - "Order": "a200_", + "Order": "a201_", "Type": "Toggle" }, "WPFToggleTaskbarSearch": { @@ -3080,7 +3088,7 @@ "Description": "If Enabled Search Button will be on the taskbar.", "category": "Customize Preferences", "panel": "2", - "Order": "a201_", + "Order": "a202_", "Type": "Toggle" }, "WPFToggleTaskView": { @@ -3088,7 +3096,7 @@ "Description": "If Enabled then Task View Button in Taskbar will be shown.", "category": "Customize Preferences", "panel": "2", - "Order": "a202_", + "Order": "a203_", "Type": "Toggle" }, "WPFToggleTaskbarWidgets": { @@ -3096,7 +3104,7 @@ "Description": "If Enabled then Widgets Button in Taskbar will be shown.", "category": "Customize Preferences", "panel": "2", - "Order": "a203_", + "Order": "a204_", "Type": "Toggle" }, "WPFOOSUbutton": { diff --git a/functions/private/Get-WinUtilToggleStatus.ps1 b/functions/private/Get-WinUtilToggleStatus.ps1 index 05db4d43..c7f0a8a9 100644 --- a/functions/private/Get-WinUtilToggleStatus.ps1 +++ b/functions/private/Get-WinUtilToggleStatus.ps1 @@ -125,6 +125,17 @@ Function Get-WinUtilToggleStatus { return $true } } + + if ($ToggleSwitch -eq "WPFToggleHiddenFiles") { + $HiddenFiles = (Get-ItemProperty -path 'HKCU:\Software\Microsoft\Windows\CurrentVersion\Explorer\Advanced').Hidden + if($HiddenFiles -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-WinUtilHiddenFiles.ps1 b/functions/private/Invoke-WinUtilHiddenFiles.ps1 new file mode 100644 index 00000000..81b3d6bb --- /dev/null +++ b/functions/private/Invoke-WinUtilHiddenFiles.ps1 @@ -0,0 +1,34 @@ +function Invoke-WinUtilHiddenFiles { + <# + + .SYNOPSIS + Enable/Disable Hidden Files + + .PARAMETER Enabled + Indicates whether to enable or disable Hidden Files + + #> + Param($Enabled) + Try{ + if ($Enabled -eq $false){ + Write-Host "Enabling Hidden Files" + $value = 1 + } + else { + Write-Host "Disabling Hidden Files" + $value = 0 + } + $Path = "HKCU:\Software\Microsoft\Windows\CurrentVersion\Explorer\Advanced" + Set-ItemProperty -Path $Path -Name Hidden -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 9d923edb..4bb4caa4 100644 --- a/functions/public/Invoke-WPFToggle.ps1 +++ b/functions/public/Invoke-WPFToggle.ps1 @@ -30,5 +30,6 @@ function Invoke-WPFToggle { "WPFToggleTaskbarWidgets" {Invoke-WinUtilTaskbarWidgets $(Get-WinUtilToggleStatus WPFToggleTaskbarWidgets)} "WPFToggleTaskbarSearch" {Invoke-WinUtilTaskbarSearch $(Get-WinUtilToggleStatus WPFToggleTaskbarSearch)} "WPFToggleTaskView" {Invoke-WinUtilTaskView $(Get-WinUtilToggleStatus WPFToggleTaskView)} + "WPFToggleHiddenFiles" {Invoke-WinUtilHiddenFiles $(Get-WinUtilToggleStatus WPFToggleHiddenFiles)} } }