Skip to content

Commit

Permalink
Fix capital (#2)
Browse files Browse the repository at this point in the history
* Winget Sources fix (ChrisTitusTech#1773)

- Sometimes, if Winget is installed under user-scope, the source isn't properly installed so that the Admin user can properly use Winget.
- This change installs the sources directly from the Winget CDN.
- Fixes ChrisTitusTech#1771
microsoft/winget-cli#3258 (reply in thread)

* Compile Winutil

* Finished conversion of DISM commands into DISM cmdlets (ChrisTitusTech#1776)

* Continue conversion

Began 2nd stage of DISM command conversion. Almost all commands have been replaced by cmdlets

* Continue conversion (part 2)

Finished part 2 of DISM command to cmdlet conversion

* Add New Toggle to Disable/Enable Widgets found in Taskbar (ChrisTitusTech#1768)

* Compile Winutil

* Fix Search Box Not Showing Apps/Tweaks Checkboxes When typing out Capital-Letters (ChrisTitusTech#1770)

* Compile Winutil

* Add Microsoft Power Automate and Swift toolchain (ChrisTitusTech#1774)

* Add power automate

* Add swift toolchain

* Compile Winutil

* Restart Explorer after Applying/Undoing Classic Right-Click Advance Tweak (ChrisTitusTech#1778)

In general, I've added two lines of code to get the explorer process using 'Get-Process', then passed the process object into 'Stop-Process', Windows will automatically restart explorer, so there's no need to run a new process for explorer.

Note: restarting explorer in the UndoScript might not be necessary, as it works just fine without it, that's according to the tests done by the author of this commit.

* Compile Winutil

* Fix capital

---------

Co-authored-by: Rux <[email protected]>
Co-authored-by: ChrisTitusTech <[email protected]>
Co-authored-by: CodingWonders <[email protected]>
Co-authored-by: Mr.k <[email protected]>
  • Loading branch information
5 people authored Apr 5, 2024
1 parent 4a7c8a3 commit 87dc6a1
Show file tree
Hide file tree
Showing 12 changed files with 267 additions and 75 deletions.
16 changes: 16 additions & 0 deletions config/applications.json
Original file line number Diff line number Diff line change
Expand Up @@ -1423,6 +1423,14 @@
"link": "https://www.postman.com/",
"winget": "Postman.Postman"
},
"WPFInstallpowerautomate": {
"category": "Microsoft Tools",
"choco": "powerautomatedesktop",
"content": "Power Automate",
"description": "Using Power Automate Desktop you can automate tasks on the desktop as well as the Web.",
"link": "https://www.microsoft.com/en-us/power-platform/products/power-automate",
"winget": "Microsoft.PowerAutomateDesktop"
},
"WPFInstallpowerbi": {
"category": "Microsoft Tools",
"choco": "powerbi",
Expand Down Expand Up @@ -1743,6 +1751,14 @@
"link": "https://stefansundin.github.io/superf4/",
"winget": "StefanSundin.Superf4"
},
"WPFInstallswift": {
"category": "Development",
"choco": "na",
"content": "Swift toolchain",
"description": "Swift is a general-purpose programming language that’s approachable for newcomers and powerful for experts.",
"link": "https://www.swift.org/",
"winget": "Swift.Toolchain"
},
"WPFInstallsynctrayzor": {
"category": "Utilities",
"choco": "synctrayzor",
Expand Down
22 changes: 19 additions & 3 deletions config/tweaks.json
Original file line number Diff line number Diff line change
Expand Up @@ -2398,12 +2398,20 @@
"panel": "1",
"Order": "a028_",
"InvokeScript": [
"New-Item -Path \"HKCU:\\Software\\Classes\\CLSID\\{86ca1aa0-34aa-4e8b-a509-50c905bae2a2}\" -Name \"InprocServer32\" -force -value \"\" "
"
New-Item -Path \"HKCU:\\Software\\Classes\\CLSID\\{86ca1aa0-34aa-4e8b-a509-50c905bae2a2}\" -Name \"InprocServer32\" -force -value \"\"
Write-Host Restarting explorer.exe ...
$process = Get-Process -Name \"explorer\"
Stop-Process -InputObject $process
"
],
"UndoScript": [
"
Remove-Item -Path \"HKCU:\\Software\\Classes\\CLSID\\{86ca1aa0-34aa-4e8b-a509-50c905bae2a2}\" -Recurse -Confirm:$false -Force
Write-Host Restart Needed for change
# Restarting Explorer in the Undo Script might not be necessary, as the Registry change without restarting Explorer does work, but just to make sure.
Write-Host Restarting explorer.exe ...
$process = Get-Process -Name \"explorer\"
Stop-Process -InputObject $process
"
]
},
Expand Down Expand Up @@ -2484,7 +2492,7 @@
},
"WPFTweaksTeredo": {
"Content": "Disable Teredo",
"Description": "Teredo network tunneling is a ipv6 feature that can cause additional latency.",
"Description": "Teredo network tunneling is a IPv6 feature that can cause additional latency.",
"category": "Essential Tweaks",
"panel": "1",
"Order": "a029_",
Expand Down Expand Up @@ -2613,6 +2621,14 @@
"Order": "a067_",
"Type": "Toggle"
},
"WPFToggleTaskbarWidgets": {
"Content": "Taskbar Widgets",
"Description": "If Enabled then Widgets Icon in Taskbar will be shown.",
"category": "Customize Preferences",
"panel": "2",
"Order": "a068_",
"Type": "Toggle"
},
"WPFchangedns": {
"Content": "DNS",
"category": "z__Advanced Tweaks - CAUTION",
Expand Down
11 changes: 10 additions & 1 deletion functions/private/Get-WinUtilToggleStatus.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -89,4 +89,13 @@ Function Get-WinUtilToggleStatus {
return $true
}
}
}
if ($ToggleSwitch -eq "WPFToggleTaskbarWidgets") {
$TaskbarWidgets = (Get-ItemProperty -Path "HKCU:\Software\Microsoft\Windows\CurrentVersion\Explorer\Advanced").TaskBarDa
if($TaskbarWidgets -eq 0) {
return $false
}
else{
return $true
}
}
}
2 changes: 2 additions & 0 deletions functions/private/Install-WinUtilWinget.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,8 @@ function Install-WinUtilWinget {
Get-WinUtilWingetLatest
Write-Host "Installing Winget w/ Prerequsites`r"
Add-AppxProvisionedPackage -Online -PackagePath $ENV:TEMP\Microsoft.DesktopAppInstaller.msixbundle -DependencyPackagePath $ENV:TEMP\Microsoft.VCLibs.x64.Desktop.appx, $ENV:TEMP\Microsoft.UI.Xaml.x64.appx -LicensePath $ENV:TEMP\License1.xml
Write-Host "Manually adding Winget Sources, from Winget CDN."
Add-AppxPackage -Path https://cdn.winget.microsoft.com/cache/source.msix #Seems some installs of Winget don't add the repo source, this should makes sure that it's installed every time.
Write-Host "Winget Installed" -ForegroundColor Green
# Winget only needs a refresh of the environment variables to be used.
Write-Output "Refreshing Environment Variables...`n"
Expand Down
42 changes: 25 additions & 17 deletions functions/private/Invoke-MicroWin-Helper.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -54,38 +54,39 @@ function Remove-Features([switch] $dumpFeatures = $false, [switch] $keepDefender
Remove-Features -keepDefender:$false
#>
$appxlist = dism /English /image:$scratchDir /Get-Features | Select-String -Pattern "Feature Name : " -CaseSensitive -SimpleMatch
$appxlist = $appxlist -split "Feature Name : " | Where-Object {$_}
$featlist = (Get-WindowsOptionalFeature -Path $scratchDir).FeatureName
if ($dumpFeatures)
{
$appxlist > allfeaturesdump.txt
$featlist > allfeaturesdump.txt
}

$appxlist = $appxlist | Where-Object {
$featlist = $featlist | Where-Object {
$_ -NotLike "*Printing*" -AND
$_ -NotLike "*TelnetClient*" -AND
$_ -NotLike "*PowerShell*" -AND
$_ -NotLike "*NetFx*"
$_ -NotLike "*NetFx*" -AND
$_ -NotLike "*Media*" -AND
$_ -NotLike "*NFS*"
}

if ($keepDefender) { $appxlist = $appxlist | Where-Object { $_ -NotLike "*Defender*" }}
if ($keepDefender) { $featlist = $featlist | Where-Object { $_ -NotLike "*Defender*" }}

foreach($feature in $appxlist)
foreach($feature in $featlist)
{
$status = "Removing feature $feature"
Write-Progress -Activity "Removing features" -Status $status -PercentComplete ($counter++/$appxlist.Count*100)
Write-Progress -Activity "Removing features" -Status $status -PercentComplete ($counter++/$featlist.Count*100)
Write-Debug "Removing feature $feature"
# dism /image:$scratchDir /Disable-Feature /FeatureName:$feature /Remove /NoRestart > $null
Disable-WindowsOptionalFeature -Path "$scratchDir" -FeatureName $feature -Remove -ErrorAction SilentlyContinue -NoRestart
}
Write-Progress -Activity "Removing features" -Status "Ready" -Completed
Write-Host "You can re-enable the disabled features at any time, using either Windows Update or the SxS folder in <installation media>\Sources."
}

function Remove-Packages
{
$appxlist = dism /English /Image:$scratchDir /Get-Packages | Select-String -Pattern "Package Identity : " -CaseSensitive -SimpleMatch
$appxlist = $appxlist -split "Package Identity : " | Where-Object {$_}
$pkglist = (Get-WindowsPackage -Path "$scratchDir").PackageName

$appxlist = $appxlist | Where-Object {
$pkglist = $pkglist | Where-Object {
$_ -NotLike "*ApplicationModel*" -AND
$_ -NotLike "*indows-Client-LanguagePack*" -AND
$_ -NotLike "*LanguageFeatures-Basic*" -AND
Expand Down Expand Up @@ -123,11 +124,18 @@ function Remove-Packages
$_ -NotLike "*UI.XaML*"
}

foreach ($appx in $appxlist)
foreach ($pkg in $pkglist)
{
$status = "Removing $appx"
Write-Progress -Activity "Removing Apps" -Status $status -PercentComplete ($counter++/$appxlist.Count*100)
dism /English /image:$scratchDir /Remove-Package /PackageName:$appx /NoRestart
try {
$status = "Removing $pkg"
Write-Progress -Activity "Removing Apps" -Status $status -PercentComplete ($counter++/$pkglist.Count*100)
Remove-WindowsPackage -Path "$scratchDir" -PackageName $pkg -NoRestart -ErrorAction SilentlyContinue
}
catch {
# This can happen if the package that is being removed is a permanent one, like FodMetadata
Write-Host "Could not remove OS package $($pkg)"
continue
}
}
Write-Progress -Activity "Removing Apps" -Status "Ready" -Completed
}
Expand Down Expand Up @@ -167,7 +175,7 @@ function Remove-ProvisionedPackages([switch] $keepSecurity = $false)
{
$status = "Removing Provisioned $($appx.PackageName)"
Write-Progress -Activity "Removing Provisioned Apps" -Status $status -PercentComplete ($counter++/$appxProvisionedPackages.Count*100)
dism /English /image:$scratchDir /Remove-ProvisionedAppxPackage /PackageName:$($appx.PackageName) /NoRestart
Remove-AppxProvisionedPackage -Path $scratchDir -PackageName $appx.PackageName -ErrorAction SilentlyContinue
}
Write-Progress -Activity "Removing Provisioned Apps" -Status "Ready" -Completed
}
Expand Down
34 changes: 34 additions & 0 deletions functions/private/Invoke-WinUtilTaskbarWidgets.ps1
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
function Invoke-WinUtilTaskbarWidgets {
<#
.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 Taskbar Widgets"
$value = 1
}
else {
Write-Host "Disabling Taskbar Widgets"
$value = 0
}
$Path = "HKCU:\Software\Microsoft\Windows\CurrentVersion\Explorer\Advanced"
Set-ItemProperty -Path $Path -Name TaskbarDa -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
}
}
4 changes: 2 additions & 2 deletions functions/public/Invoke-WPFMicrowin.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -117,7 +117,7 @@ public class PowerManagement {
if (Test-Path $driverPath)
{
Write-Host "Adding Windows Drivers image($scratchDir) drivers($driverPath) "
dism /English /image:$scratchDir /add-driver /driver:$driverPath /recurse | Out-Host
Add-WindowsDriver -Path "$scratchDir" -Recurse -Driver "$driverPath"
}
else
{
Expand Down Expand Up @@ -335,7 +335,7 @@ public class PowerManagement {
if (Test-Path $driverPath)
{
Write-Host "Adding Windows Drivers image($scratchDir) drivers($driverPath) "
dism /English /image:$scratchDir /add-driver /driver:$driverPath /recurse | Out-Host
Add-WindowsDriver -Path "$scratchDir" -Driver "$driverPath" -Recurse
}
else
{
Expand Down
3 changes: 2 additions & 1 deletion functions/public/Invoke-WPFToggle.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -25,5 +25,6 @@ function Invoke-WPFToggle {
"WPFToggleSnapFlyout" {Invoke-WinUtilSnapFlyout $(Get-WinUtilToggleStatus WPFToggleSnapFlyout)}
"WPFToggleMouseAcceleration" {Invoke-WinUtilMouseAcceleration $(Get-WinUtilToggleStatus WPFToggleMouseAcceleration)}
"WPFToggleStickyKeys" {Invoke-WinUtilStickyKeys $(Get-WinUtilToggleStatus WPFToggleStickyKeys)}
"WPFToggleTaskbarWidgets" {Invoke-WinUtilTaskbarWidgets $(Get-WinUtilToggleStatus WPFToggleTaskbarWidgets)}
}
}
}
2 changes: 1 addition & 1 deletion scripts/main.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -381,7 +381,7 @@ $sync["CheckboxFilter"].Add_TextChanged({
continue
}

$textToSearch = $sync.CheckboxFilter.Text
$textToSearch = $sync.CheckboxFilter.Text.ToLower()
$checkBoxName = $CheckBox.Key
$textBlockName = $checkBoxName + "Link"

Expand Down
Loading

0 comments on commit 87dc6a1

Please sign in to comment.