From 51e3523e8366421d4d8c18076f9b77cc82ba3f92 Mon Sep 17 00:00:00 2001 From: Yuri Gabriel <97139700+Yuuh15@users.noreply.github.com> Date: Fri, 26 Jan 2024 14:57:10 -0300 Subject: [PATCH] Revert "Update winutil.ps1" This reverts commit aaa69c473ff814a7de9e4f7e4591fa5c0f786ffc. --- winutil.ps1 | 227 ++++++++++++++++++++++++++++++++++++++++++++++------ 1 file changed, 201 insertions(+), 26 deletions(-) diff --git a/winutil.ps1 b/winutil.ps1 index 7926b914..2b99ed7e 100644 --- a/winutil.ps1 +++ b/winutil.ps1 @@ -10,7 +10,7 @@ Author : Chris Titus @christitustech Runspace Author: @DeveloperDurp GitHub : https://github.com/ChrisTitusTech - Version : 24.01.15 + Version : 24.01.25 #> param ( [switch]$Debug, @@ -47,7 +47,7 @@ Add-Type -AssemblyName System.Windows.Forms # Variable to sync between runspaces $sync = [Hashtable]::Synchronized(@{}) $sync.PSScriptRoot = $PSScriptRoot -$sync.version = "24.01.15" +$sync.version = "24.01.25" $sync.configs = @{} $sync.ProcessRunning = $false @@ -452,6 +452,15 @@ Function Get-WinUtilToggleStatus { return $false } } + if($ToggleSwitch -eq "WPFToggleSnapFlyout"){ + $hidesnap = (Get-ItemProperty -path 'HKCU:\Software\Microsoft\Windows\CurrentVersion\Explorer\Advanced').EnableSnapAssistFlyout + if($hidesnap -eq 0){ + return $false + } + else{ + return $true + } + } if($ToggleSwitch -eq "WPFToggleMouseAcceleration"){ $MouseSpeed = (Get-ItemProperty -path 'HKCU:\Control Panel\Mouse').MouseSpeed $MouseThreshold1 = (Get-ItemProperty -path 'HKCU:\Control Panel\Mouse').MouseThreshold1 @@ -558,7 +567,7 @@ Function Install-WinUtilProgramWinget { Write-Progress -Activity "$manage Applications" -Status "$manage $Program $($x + 1) of $count" -PercentComplete $($x/$count*100) if($manage -eq "Installing"){ - Start-Process -FilePath winget -ArgumentList "install -e --accept-source-agreements --accept-package-agreements --silent $Program" -NoNewWindow -Wait + Start-Process -FilePath winget -ArgumentList "install -e --accept-source-agreements --accept-package-agreements --scope=machine --silent $Program" -NoNewWindow -Wait } if($manage -eq "Uninstalling"){ Start-Process -FilePath winget -ArgumentList "uninstall -e --purge --force --silent $Program" -NoNewWindow -Wait @@ -1599,6 +1608,40 @@ function Invoke-WinUtilShowExt { Write-Warning $psitem.Exception.StackTrace } } +function Invoke-WinUtilSnapFlyout { + <# + .SYNOPSIS + Disables/Enables Snap Assist Flyout on startup + .PARAMETER Enabled + Indicates whether to enable or disable Snap Assist Flyout on startup + #> + Param($Enabled) + Try{ + if ($Enabled -eq $false){ + Write-Host "Enabling Snap Assist Flyout On startup" + $value = 1 + } + else { + Write-Host "Disabling Snap Assist Flyout On startup" + $value = 0 + } + # taskkill.exe /F /IM "explorer.exe" + $Path = "HKCU:\Software\Microsoft\Windows\CurrentVersion\Explorer\Advanced" + taskkill.exe /F /IM "explorer.exe" + Set-ItemProperty -Path $Path -Name EnableSnapAssistFlyout -Value $value + Start-Process "explorer.exe" + } + 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-WinUtilTweaks { <# @@ -2663,7 +2706,7 @@ function Invoke-WPFGetIso { # @ChrisTitusTech please copy this wiki and change the link below to your copy of the wiki Write-Error "Failed to mount the image. Error: $($_.Exception.Message)" Write-Error "This is NOT winutil's problem, your ISO might be corrupt, or there is a problem on the system" - Write-Error "Please refer to this wiki for more details https://github.com/KonTy/winutil/wiki/Error-in-Winutil-MicroWin-during-ISO-mounting" + Write-Error "Please refer to this wiki for more details https://github.com/ChrisTitusTech/winutil/blob/main/wiki/Error-in-Winutil-MicroWin-during-ISO-mounting%2Cmd" return } # storing off values in hidden fields for further steps @@ -3330,7 +3373,7 @@ function Invoke-WPFPresets { $CheckBoxesToCheck = $sync.configs.preset.$preset } - $CheckBoxes = $sync.GetEnumerator() | Where-Object { $_.Value -is [System.Windows.Controls.CheckBox] } + $CheckBoxes = $sync.GetEnumerator() | Where-Object { $_.Value -is [System.Windows.Controls.CheckBox] -and $_.Name -notlike "WPFToggle*" } Write-Debug "Getting checkboxes to set $($CheckBoxes.Count)" $CheckBoxesToCheck | ForEach-Object { @@ -3510,6 +3553,7 @@ function Invoke-WPFToggle { "WPFToggleNumLock" {Invoke-WinUtilNumLock $(Get-WinUtilToggleStatus WPFToggleNumLock)} "WPFToggleVerboseLogon" {Invoke-WinUtilVerboseLogon $(Get-WinUtilToggleStatus WPFToggleVerboseLogon)} "WPFToggleShowExt" {Invoke-WinUtilShowExt $(Get-WinUtilToggleStatus WPFToggleShowExt)} + "WPFToggleSnapFlyout" {Invoke-WinUtilSnapFlyout $(Get-WinUtilToggleStatus WPFToggleSnapFlyout)} "WPFToggleMouseAcceleration" {Invoke-WinUtilMouseAcceleration $(Get-WinUtilToggleStatus WPFToggleMouseAcceleration)} } } @@ -4881,6 +4925,11 @@ $inputXML = ' + + +