Toggle Search Button in the taskbar (#2162)

This commit is contained in:
Justawildwolf 2024-06-28 15:02:32 +00:00 committed by GitHub
parent a0c4b33483
commit 227babe0e8
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
4 changed files with 54 additions and 2 deletions

View File

@ -3068,7 +3068,15 @@
"Description": "If Enabled then Sticky Keys is activated - Sticky keys is an accessibility feature of some graphical user interfaces which assists users who have physical disabilities or help users reduce repetitive strain injury.", "Description": "If Enabled then Sticky Keys is activated - Sticky keys is an accessibility feature of some graphical user interfaces which assists users who have physical disabilities or help users reduce repetitive strain injury.",
"category": "Customize Preferences", "category": "Customize Preferences",
"panel": "2", "panel": "2",
"Order": "a069_", "Order": "a070_",
"Type": "Toggle"
},
"WPFToggleTaskbarSearch": {
"Content": "Taskbar Search",
"Description": "If Enabled Search Button will be on the taskbar.",
"category": "Customize Preferences",
"panel": "2",
"Order": "a068_",
"Type": "Toggle" "Type": "Toggle"
}, },
"WPFOOSUbutton": { "WPFOOSUbutton": {
@ -3083,7 +3091,7 @@
"Description": "If Enabled then Widgets Icon in Taskbar will be shown.", "Description": "If Enabled then Widgets Icon in Taskbar will be shown.",
"category": "Customize Preferences", "category": "Customize Preferences",
"panel": "2", "panel": "2",
"Order": "a068_", "Order": "a069_",
"Type": "Toggle" "Type": "Toggle"
}, },
"WPFchangedns": { "WPFchangedns": {

View File

@ -98,6 +98,15 @@ Function Get-WinUtilToggleStatus {
return $false return $false
} }
} }
if($ToggleSwitch -eq "WPFToggleTaskbarSearch"){
$SearchButton = (Get-ItemProperty -path "HKCU:\Software\Microsoft\Windows\CurrentVersion\Search").SearchboxTaskbarMode
if($SearchButton -eq 0){
return $false
}
else{
return $true
}
}
if ($ToggleSwitch -eq "WPFToggleStickyKeys") { if ($ToggleSwitch -eq "WPFToggleStickyKeys") {
$StickyKeys = (Get-ItemProperty -path 'HKCU:\Control Panel\Accessibility\StickyKeys').Flags $StickyKeys = (Get-ItemProperty -path 'HKCU:\Control Panel\Accessibility\StickyKeys').Flags
if($StickyKeys -eq 58){ if($StickyKeys -eq 58){

View File

@ -0,0 +1,34 @@
function Invoke-WinUtilTaskbarSearch {
<#
.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 Search Button"
$value = 1
}
else {
Write-Host "Disabling Search Button"
$value = 0
}
$Path = "HKCU:\Software\Microsoft\Windows\CurrentVersion\Search\"
Set-ItemProperty -Path $Path -Name SearchboxTaskbarMode -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

@ -28,5 +28,6 @@ function Invoke-WPFToggle {
"WPFToggleMouseAcceleration" {Invoke-WinUtilMouseAcceleration $(Get-WinUtilToggleStatus WPFToggleMouseAcceleration)} "WPFToggleMouseAcceleration" {Invoke-WinUtilMouseAcceleration $(Get-WinUtilToggleStatus WPFToggleMouseAcceleration)}
"WPFToggleStickyKeys" {Invoke-WinUtilStickyKeys $(Get-WinUtilToggleStatus WPFToggleStickyKeys)} "WPFToggleStickyKeys" {Invoke-WinUtilStickyKeys $(Get-WinUtilToggleStatus WPFToggleStickyKeys)}
"WPFToggleTaskbarWidgets" {Invoke-WinUtilTaskbarWidgets $(Get-WinUtilToggleStatus WPFToggleTaskbarWidgets)} "WPFToggleTaskbarWidgets" {Invoke-WinUtilTaskbarWidgets $(Get-WinUtilToggleStatus WPFToggleTaskbarWidgets)}
"WPFToggleTaskbarSearch" {Invoke-WinUtilTaskbarSearch $(Get-WinUtilToggleStatus WPFToggleTaskbarSearch)}
} }
} }