This commit is contained in:
Chris Titus 2024-07-14 21:01:19 -05:00
commit 40cf1f80ef
6 changed files with 117 additions and 11 deletions

View File

@ -41,9 +41,7 @@ If you have Issues, refer to [Known Issues](https://christitustech.github.io/win
### [WinUtil Official Documentation](https://christitustech.github.io/winutil/) ### [WinUtil Official Documentation](https://christitustech.github.io/winutil/)
### YouTube Tutorial ### [YouTube Tutorial](https://www.youtube.com/watch?v=6UQZ5oQg8XA)
[![Watch the video](https://img.youtube.com/vi/6UQZ5oQg8XA/hqdefault.jpg)](https://www.youtube.com/watch?v=6UQZ5oQg8XA)
### [ChrisTitus.com Article](https://christitus.com/windows-tool/) ### [ChrisTitus.com Article](https://christitus.com/windows-tool/)

View File

@ -3123,6 +3123,14 @@
"Order": "a204_", "Order": "a204_",
"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

@ -138,11 +138,20 @@ Function Get-WinUtilToggleStatus {
if ($ToggleSwitch -eq "WPFToggleTaskbarWidgets") { if ($ToggleSwitch -eq "WPFToggleTaskbarWidgets") {
$TaskbarWidgets = (Get-ItemProperty -Path "HKCU:\Software\Microsoft\Windows\CurrentVersion\Explorer\Advanced").TaskBarDa $TaskbarWidgets = (Get-ItemProperty -Path "HKCU:\Software\Microsoft\Windows\CurrentVersion\Explorer\Advanced").TaskBarDa
if($TaskbarWidgets -eq 0) { if($TaskbarWidgets -eq 0) {
return $false return $false
} }
else{ else{
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

@ -31,5 +31,6 @@ function Invoke-WPFToggle {
"WPFToggleTaskbarSearch" {Invoke-WinUtilTaskbarSearch $(Get-WinUtilToggleStatus WPFToggleTaskbarSearch)} "WPFToggleTaskbarSearch" {Invoke-WinUtilTaskbarSearch $(Get-WinUtilToggleStatus WPFToggleTaskbarSearch)}
"WPFToggleTaskView" {Invoke-WinUtilTaskView $(Get-WinUtilToggleStatus WPFToggleTaskView)} "WPFToggleTaskView" {Invoke-WinUtilTaskView $(Get-WinUtilToggleStatus WPFToggleTaskView)}
"WPFToggleHiddenFiles" {Invoke-WinUtilHiddenFiles $(Get-WinUtilToggleStatus WPFToggleHiddenFiles)} "WPFToggleHiddenFiles" {Invoke-WinUtilHiddenFiles $(Get-WinUtilToggleStatus WPFToggleHiddenFiles)}
"WPFToggleTaskbarAlignment" {Invoke-WinUtilTaskbarAlignment $(Get-WinUtilToggleStatus WPFToggleTaskbarAlignment)}
} }
} }

View File

@ -728,12 +728,21 @@ Function Get-WinUtilToggleStatus {
if ($ToggleSwitch -eq "WPFToggleTaskbarWidgets") { if ($ToggleSwitch -eq "WPFToggleTaskbarWidgets") {
$TaskbarWidgets = (Get-ItemProperty -Path "HKCU:\Software\Microsoft\Windows\CurrentVersion\Explorer\Advanced").TaskBarDa $TaskbarWidgets = (Get-ItemProperty -Path "HKCU:\Software\Microsoft\Windows\CurrentVersion\Explorer\Advanced").TaskBarDa
if($TaskbarWidgets -eq 0) { if($TaskbarWidgets -eq 0) {
return $false return $false
} }
else{ else{
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
}
} }
} }
function Get-WinUtilVariables { function Get-WinUtilVariables {
@ -2403,6 +2412,40 @@ Function Invoke-WinUtilStickyKeys {
Write-Warning $psitem.Exception.StackTrace Write-Warning $psitem.Exception.StackTrace
} }
} }
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
}
}
function Invoke-WinUtilTaskbarSearch { function Invoke-WinUtilTaskbarSearch {
<# <#
@ -5106,6 +5149,7 @@ function Invoke-WPFToggle {
"WPFToggleTaskbarSearch" {Invoke-WinUtilTaskbarSearch $(Get-WinUtilToggleStatus WPFToggleTaskbarSearch)} "WPFToggleTaskbarSearch" {Invoke-WinUtilTaskbarSearch $(Get-WinUtilToggleStatus WPFToggleTaskbarSearch)}
"WPFToggleTaskView" {Invoke-WinUtilTaskView $(Get-WinUtilToggleStatus WPFToggleTaskView)} "WPFToggleTaskView" {Invoke-WinUtilTaskView $(Get-WinUtilToggleStatus WPFToggleTaskView)}
"WPFToggleHiddenFiles" {Invoke-WinUtilHiddenFiles $(Get-WinUtilToggleStatus WPFToggleHiddenFiles)} "WPFToggleHiddenFiles" {Invoke-WinUtilHiddenFiles $(Get-WinUtilToggleStatus WPFToggleHiddenFiles)}
"WPFToggleTaskbarAlignment" {Invoke-WinUtilTaskbarAlignment $(Get-WinUtilToggleStatus WPFToggleTaskbarAlignment)}
} }
} }
function Invoke-WPFTweakPS7{ function Invoke-WPFTweakPS7{
@ -12275,6 +12319,14 @@ $sync.configs.tweaks = '{
"Order": "a204_", "Order": "a204_",
"Type": "Toggle" "Type": "Toggle"
}, },
"WPFToggleTaskbarAlignment": {
"Content": "Switch Taskbar Items between Center &#38; 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",
@ -14727,6 +14779,10 @@ $inputXML = '<Window x:Class="WinUtility.MainWindow"
<CheckBox Name="WPFToggleTaskView" Style="{StaticResource ColorfulToggleSwitchStyle}" Margin="4,0" HorizontalAlignment="Right" FontSize="{FontSize}"/> <CheckBox Name="WPFToggleTaskView" Style="{StaticResource ColorfulToggleSwitchStyle}" Margin="4,0" HorizontalAlignment="Right" FontSize="{FontSize}"/>
<Label Content="Show Task View Button in Taskbar" ToolTip="If Enabled then Task View Button in Taskbar will be shown." HorizontalAlignment="Left" FontSize="{FontSize}"/> <Label Content="Show Task View Button in Taskbar" ToolTip="If Enabled then Task View Button in Taskbar will be shown." HorizontalAlignment="Left" FontSize="{FontSize}"/>
</DockPanel> </DockPanel>
<DockPanel LastChildFill="True">
<CheckBox Name="WPFToggleTaskbarAlignment" Style="{StaticResource ColorfulToggleSwitchStyle}" Margin="4,0" HorizontalAlignment="Right" FontSize="{FontSize}"/>
<Label Content="Switch Taskbar Items between Center &#38; Left" ToolTip="[Windows 11] If Enabled then the Taskbar Items will be shown on the Center, otherwise the Taskbar Items will be shown on the Left." HorizontalAlignment="Left" FontSize="{FontSize}"/>
</DockPanel>
<DockPanel LastChildFill="True"> <DockPanel LastChildFill="True">
<CheckBox Name="WPFToggleTaskbarWidgets" Style="{StaticResource ColorfulToggleSwitchStyle}" Margin="4,0" HorizontalAlignment="Right" FontSize="{FontSize}"/> <CheckBox Name="WPFToggleTaskbarWidgets" Style="{StaticResource ColorfulToggleSwitchStyle}" Margin="4,0" HorizontalAlignment="Right" FontSize="{FontSize}"/>
<Label Content="Show Widgets Button in Taskbar" ToolTip="If Enabled then Widgets Button in Taskbar will be shown." HorizontalAlignment="Left" FontSize="{FontSize}"/> <Label Content="Show Widgets Button in Taskbar" ToolTip="If Enabled then Widgets Button in Taskbar will be shown." HorizontalAlignment="Left" FontSize="{FontSize}"/>