Add New Windows 11 Specific Toggle - The 'Taskbar Alignment' Toggle

This commit is contained in:
Mr.k 2024-07-13 17:30:15 +03:00
parent af1743066f
commit 0c7d639212
No known key found for this signature in database
4 changed files with 56 additions and 4 deletions

View File

@ -3099,6 +3099,14 @@
"Order": "a203_", "Order": "a203_",
"Type": "Toggle" "Type": "Toggle"
}, },
"WPFToggleTaskbarAlignment": {
"Content": "Switch Taskbar Items between Center & Left",
"Description": "[Windows 11] If Enabled then the Taskbar Items will be shown on the Center, otherwise the Taskbar Items will be shown on the Left.",
"category": "Customize Preferences",
"panel": "2",
"Order": "a204_",
"Type": "Toggle"
},
"WPFOOSUbutton": { "WPFOOSUbutton": {
"Content": "Run OO Shutup 10", "Content": "Run OO Shutup 10",
"category": "z__Advanced Tweaks - CAUTION", "category": "z__Advanced Tweaks - CAUTION",

View File

@ -134,4 +134,13 @@ Function Get-WinUtilToggleStatus {
return $true return $true
} }
} }
if ($ToggleSwitch -eq "WPFToggleTaskbarAlignment") {
$TaskbarAlignment = (Get-ItemProperty -Path "HKCU:\SOFTWARE\Microsoft\Windows\CurrentVersion\Explorer\Advanced").TaskbarAl
if($TaskbarAlignment -eq 0) {
return $false
}
else{
return $true
}
}
} }

View File

@ -0,0 +1,34 @@
function Invoke-WinUtilTaskbarAlignment {
<#
.SYNOPSIS
Switches between Center & Left Taskbar Alignment
.PARAMETER Enabled
Indicates whether to make Taskbar Alignment Center or Left
#>
Param($Enabled)
Try{
if ($Enabled -eq $false){
Write-Host "Making Taskbar Alignment to the Center"
$value = 1
}
else {
Write-Host "Making Taskbar Alignment to the Left"
$value = 0
}
$Path = "HKCU:\SOFTWARE\Microsoft\Windows\CurrentVersion\Explorer\Advanced"
Set-ItemProperty -Path $Path -Name "TaskbarAl" -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)} "WPFToggleTaskbarWidgets" {Invoke-WinUtilTaskbarWidgets $(Get-WinUtilToggleStatus WPFToggleTaskbarWidgets)}
"WPFToggleTaskbarSearch" {Invoke-WinUtilTaskbarSearch $(Get-WinUtilToggleStatus WPFToggleTaskbarSearch)} "WPFToggleTaskbarSearch" {Invoke-WinUtilTaskbarSearch $(Get-WinUtilToggleStatus WPFToggleTaskbarSearch)}
"WPFToggleTaskView" {Invoke-WinUtilTaskView $(Get-WinUtilToggleStatus WPFToggleTaskView)} "WPFToggleTaskView" {Invoke-WinUtilTaskView $(Get-WinUtilToggleStatus WPFToggleTaskView)}
"WPFToggleTaskbarAlignment" {Invoke-WinUtilTaskbarAlignment $(Get-WinUtilToggleStatus WPFToggleTaskbarAlignment)}
} }
} }