Skip to content

Commit

Permalink
Add New Windows 11 Specific Toggle - The 'Taskbar Alignment' Toggle (#…
Browse files Browse the repository at this point in the history
  • Loading branch information
og-mrk authored Jul 15, 2024
1 parent 792a5c4 commit 904e0ad
Show file tree
Hide file tree
Showing 4 changed files with 56 additions and 4 deletions.
8 changes: 8 additions & 0 deletions config/tweaks.json
Original file line number Diff line number Diff line change
Expand Up @@ -3123,6 +3123,14 @@
"Order": "a204_",
"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": {
"Content": "Run OO Shutup 10",
"category": "z__Advanced Tweaks - CAUTION",
Expand Down
17 changes: 13 additions & 4 deletions functions/private/Get-WinUtilToggleStatus.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -138,11 +138,20 @@ Function Get-WinUtilToggleStatus {

if ($ToggleSwitch -eq "WPFToggleTaskbarWidgets") {
$TaskbarWidgets = (Get-ItemProperty -Path "HKCU:\Software\Microsoft\Windows\CurrentVersion\Explorer\Advanced").TaskBarDa
if($TaskbarWidgets -eq 0) {
if($TaskbarWidgets -eq 0) {
return $false
}
else{
}
else{
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
}
}
}
34 changes: 34 additions & 0 deletions functions/private/Invoke-WinUtilTaskbarAlignment.ps1
Original file line number Diff line number Diff line change
@@ -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
}
}
1 change: 1 addition & 0 deletions functions/public/Invoke-WPFToggle.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -31,5 +31,6 @@ function Invoke-WPFToggle {
"WPFToggleTaskbarSearch" {Invoke-WinUtilTaskbarSearch $(Get-WinUtilToggleStatus WPFToggleTaskbarSearch)}
"WPFToggleTaskView" {Invoke-WinUtilTaskView $(Get-WinUtilToggleStatus WPFToggleTaskView)}
"WPFToggleHiddenFiles" {Invoke-WinUtilHiddenFiles $(Get-WinUtilToggleStatus WPFToggleHiddenFiles)}
"WPFToggleTaskbarAlignment" {Invoke-WinUtilTaskbarAlignment $(Get-WinUtilToggleStatus WPFToggleTaskbarAlignment)}
}
}

0 comments on commit 904e0ad

Please sign in to comment.