Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add Search Button Toggle in the Tweaks Section #2162

Merged
merged 2 commits into from
Jun 28, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 10 additions & 2 deletions config/tweaks.json
Original file line number Diff line number Diff line change
Expand Up @@ -3059,7 +3059,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.",
"category": "Customize Preferences",
"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"
},
"WPFOOSUbutton": {
Expand All @@ -3074,7 +3082,7 @@
"Description": "If Enabled then Widgets Icon in Taskbar will be shown.",
"category": "Customize Preferences",
"panel": "2",
"Order": "a068_",
"Order": "a069_",
"Type": "Toggle"
},
"WPFchangedns": {
Expand Down
9 changes: 9 additions & 0 deletions functions/private/Get-WinUtilToggleStatus.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -98,6 +98,15 @@ Function Get-WinUtilToggleStatus {
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") {
$StickyKeys = (Get-ItemProperty -path 'HKCU:\Control Panel\Accessibility\StickyKeys').Flags
if($StickyKeys -eq 58){
Expand Down
34 changes: 34 additions & 0 deletions functions/private/Invoke-WinUtilTaskbarSearch.ps1
Original file line number Diff line number Diff line change
@@ -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
}
}
1 change: 1 addition & 0 deletions functions/public/Invoke-WPFToggle.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -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)}
"WPFToggleTaskbarSearch" {Invoke-WinUtilTaskbarSearch $(Get-WinUtilToggleStatus WPFToggleTaskbarSearch)}
}
}