Hidden File Tweaks (#2320)

* Main

* Fixes previous issues

* Change the ordering of Some Toggle for Consistency

---------

Co-authored-by: Mr.k <mineshtine28546271@gmail.com>
This commit is contained in:
Real-MullaC 2024-07-15 02:01:09 +01:00 committed by GitHub
parent 5b7f0a0edf
commit af36d76e65
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
4 changed files with 58 additions and 4 deletions

View File

@ -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": {

View File

@ -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) {

View File

@ -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
}
}

View File

@ -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)}
}
}