diff --git a/config/tweaks.json b/config/tweaks.json index b39c5446c8..cff503eb81 100644 --- a/config/tweaks.json +++ b/config/tweaks.json @@ -71,7 +71,7 @@ Get-AppxPackage Microsoft.WidgetsPlatformRuntime -AllUsers | Remove-AppxPackage -AllUsers Get-AppxPackage MicrosoftWindows.Client.WebExperience -AllUsers | Remove-AppxPackage -AllUsers - Invoke-WinUtilExplorerUpdate -action \"restart\" + Stop-Process -Name explorer Write-Host \"Removed widgets\" " ], @@ -1292,7 +1292,7 @@ ], "InvokeScript": [ " - Invoke-WinUtilExplorerUpdate + Stop-Process -Name explorer if ($sync.ThemeButton.Content -eq [char]0xF08C) { Invoke-WinutilThemeChange -theme \"Auto\" } @@ -1300,7 +1300,7 @@ ], "UndoScript": [ " - Invoke-WinUtilExplorerUpdate + Stop-Process -Name explorer if ($sync.ThemeButton.Content -eq [char]0xF08C) { Invoke-WinutilThemeChange -theme \"Auto\" } @@ -1325,14 +1325,10 @@ } ], "InvokeScript": [ - " - Invoke-WinUtilExplorerUpdate -action \"restart\" - " + "Stop-Process -Name explorer" ], "UndoScript": [ - " - Invoke-WinUtilExplorerUpdate -action \"restart\" - " + "Stop-Process -Name explorer" ], "link": "https://winutil.christitus.com/dev/tweaks/customize-preferences/showext" }, @@ -1353,14 +1349,10 @@ } ], "InvokeScript": [ - " - Invoke-WinUtilExplorerUpdate -action \"restart\" - " + "Stop-Process -Name explorer" ], "UndoScript": [ - " - Invoke-WinUtilExplorerUpdate -action \"restart\" - " + "Stop-Process -Name explorer" ], "link": "https://winutil.christitus.com/dev/tweaks/customize-preferences/hiddenfiles" }, @@ -1669,14 +1661,10 @@ } ], "InvokeScript": [ - " - Invoke-WinUtilExplorerUpdate -action \"restart\" - " + "Stop-Process -Name explorer" ], "UndoScript": [ - " - Invoke-WinUtilExplorerUpdate -action \"restart\" - " + "Stop-Process -Name explorer" ], "link": "https://winutil.christitus.com/dev/tweaks/customize-preferences/startmenurecommendations" }, @@ -1715,14 +1703,10 @@ } ], "InvokeScript": [ - " - Invoke-WinUtilExplorerUpdate -action \"restart\" - " + "Stop-Process -Name explorer" ], "UndoScript": [ - " - Invoke-WinUtilExplorerUpdate -action \"restart\" - " + "Stop-Process -Name explorer" ], "link": "https://winutil.christitus.com/dev/tweaks/customize-preferences/taskbaralignment" }, diff --git a/functions/private/Invoke-WinUtilExplorerUpdate.ps1 b/functions/private/Invoke-WinUtilExplorerUpdate.ps1 deleted file mode 100644 index d51a8133f3..0000000000 --- a/functions/private/Invoke-WinUtilExplorerUpdate.ps1 +++ /dev/null @@ -1,38 +0,0 @@ -function Invoke-WinUtilExplorerUpdate { - <# - .SYNOPSIS - Refreshes the Windows Explorer - #> - param ( - [string]$action = "refresh" - ) - - if ($action -eq "refresh") { - Invoke-WPFRunspace -ScriptBlock { - # Define the Win32 type only if it doesn't exist - if (-not ([System.Management.Automation.PSTypeName]'Win32').Type) { - Add-Type -TypeDefinition @" -using System; -using System.Runtime.InteropServices; -public class Win32 { - [DllImport("user32.dll", CharSet = CharSet.Auto, SetLastError = false)] - public static extern IntPtr SendMessageTimeout( - IntPtr hWnd, uint Msg, IntPtr wParam, string lParam, - uint fuFlags, uint uTimeout, out IntPtr lpdwResult); -} -"@ - } - - $HWND_BROADCAST = [IntPtr]0xffff - $WM_SETTINGCHANGE = 0x1A - $SMTO_ABORTIFHUNG = 0x2 - - [Win32]::SendMessageTimeout($HWND_BROADCAST, $WM_SETTINGCHANGE, - [IntPtr]::Zero, "ImmersiveColorSet", $SMTO_ABORTIFHUNG, 100, - [ref]([IntPtr]::Zero)) - } - } elseif ($action -eq "restart") { - taskkill.exe /F /IM "explorer.exe" - Start-Process "explorer.exe" - } -}