From 7574dc96d1453f61cea3b713b370b0f239fa5c03 Mon Sep 17 00:00:00 2001 From: Dmitry Nefedov Date: Sun, 5 Feb 2023 18:17:01 +0300 Subject: [PATCH] WSL function re-written --- Wrapper/Config/config_Windows_10.json | 2 +- Wrapper/Config/config_Windows_10_LTSC.json | 2 +- Wrapper/Config/config_Windows_11.json | 2 +- .../de-DE/tooltip_Windows_10.json | 2 +- .../de-DE/tooltip_Windows_11.json | 2 +- .../en-US/tooltip_Windows_10.json | 2 +- .../en-US/tooltip_Windows_11.json | 2 +- .../ru-RU/tooltip_Windows_10.json | 2 +- .../ru-RU/tooltip_Windows_11.json | 2 +- .../Module/Sophia.psm1 | 119 ++++++++--------- src/Sophia_Script_for_Windows_10/Sophia.ps1 | 8 +- .../Module/Sophia.psm1 | 4 +- .../Sophia.ps1 | 2 +- .../Module/Sophia.psm1 | 119 ++++++++--------- .../Sophia.ps1 | 8 +- .../Module/Sophia.psm1 | 124 ++++++++---------- src/Sophia_Script_for_Windows_11/Sophia.ps1 | 6 +- .../Module/Sophia.psm1 | 118 ++++++++--------- .../Sophia.ps1 | 6 +- 19 files changed, 240 insertions(+), 292 deletions(-) diff --git a/Wrapper/Config/config_Windows_10.json b/Wrapper/Config/config_Windows_10.json index 92593f15..43bb5069 100644 --- a/Wrapper/Config/config_Windows_10.json +++ b/Wrapper/Config/config_Windows_10.json @@ -1832,7 +1832,7 @@ "Region": "UWP apps", "Control": "cmb", "Required": "false", - "Function": "HEIF", + "Function": "HEVC", "Arg": { "Zero": { "Tag": "Manually" diff --git a/Wrapper/Config/config_Windows_10_LTSC.json b/Wrapper/Config/config_Windows_10_LTSC.json index 98b1c550..8f264665 100644 --- a/Wrapper/Config/config_Windows_10_LTSC.json +++ b/Wrapper/Config/config_Windows_10_LTSC.json @@ -2020,7 +2020,7 @@ "Region": "UWP apps", "Control": "cmb", "Required": "false", - "Function": "HEIF", + "Function": "HEVC", "Arg": { "Zero": { "Tag": "Manually" diff --git a/Wrapper/Config/config_Windows_11.json b/Wrapper/Config/config_Windows_11.json index 4aabd1e0..bf3bcc03 100644 --- a/Wrapper/Config/config_Windows_11.json +++ b/Wrapper/Config/config_Windows_11.json @@ -1692,7 +1692,7 @@ "Region": "UWP apps", "Control": "cmb", "Required": "false", - "Function": "HEIF", + "Function": "HEVC", "Arg": { "Zero": { "Tag": "Manually" diff --git a/Wrapper/Localizations/de-DE/tooltip_Windows_10.json b/Wrapper/Localizations/de-DE/tooltip_Windows_10.json index 8fb5438b..5d3e0dd0 100644 --- a/Wrapper/Localizations/de-DE/tooltip_Windows_10.json +++ b/Wrapper/Localizations/de-DE/tooltip_Windows_10.json @@ -1627,7 +1627,7 @@ { "Id": 803, "Region": "UWP apps", - "Function": "HEIF", + "Function": "HEVC", "Arg": { "Zero": { "Tag": "Manually", diff --git a/Wrapper/Localizations/de-DE/tooltip_Windows_11.json b/Wrapper/Localizations/de-DE/tooltip_Windows_11.json index 962a2fb5..761bffa3 100644 --- a/Wrapper/Localizations/de-DE/tooltip_Windows_11.json +++ b/Wrapper/Localizations/de-DE/tooltip_Windows_11.json @@ -1502,7 +1502,7 @@ { "Id": 803, "Region": "UWP apps", - "Function": "HEIF", + "Function": "HEVC", "Arg": { "Zero": { "Tag": "Manually", diff --git a/Wrapper/Localizations/en-US/tooltip_Windows_10.json b/Wrapper/Localizations/en-US/tooltip_Windows_10.json index 9fa9e15a..33838867 100644 --- a/Wrapper/Localizations/en-US/tooltip_Windows_10.json +++ b/Wrapper/Localizations/en-US/tooltip_Windows_10.json @@ -1627,7 +1627,7 @@ { "Id": 803, "Region": "UWP apps", - "Function": "HEIF", + "Function": "HEVC", "Arg": { "Zero": { "Tag": "Manually", diff --git a/Wrapper/Localizations/en-US/tooltip_Windows_11.json b/Wrapper/Localizations/en-US/tooltip_Windows_11.json index 956809f1..93060254 100644 --- a/Wrapper/Localizations/en-US/tooltip_Windows_11.json +++ b/Wrapper/Localizations/en-US/tooltip_Windows_11.json @@ -1502,7 +1502,7 @@ { "Id": 803, "Region": "UWP apps", - "Function": "HEIF", + "Function": "HEVC", "Arg": { "Zero": { "Tag": "Manually", diff --git a/Wrapper/Localizations/ru-RU/tooltip_Windows_10.json b/Wrapper/Localizations/ru-RU/tooltip_Windows_10.json index f63919f5..566f97f7 100644 --- a/Wrapper/Localizations/ru-RU/tooltip_Windows_10.json +++ b/Wrapper/Localizations/ru-RU/tooltip_Windows_10.json @@ -1627,7 +1627,7 @@ { "Id": 803, "Region": "UWP apps", - "Function": "HEIF", + "Function": "HEVC", "Arg": { "Zero": { "Tag": "Manually", diff --git a/Wrapper/Localizations/ru-RU/tooltip_Windows_11.json b/Wrapper/Localizations/ru-RU/tooltip_Windows_11.json index 70f33100..5f1ff01a 100644 --- a/Wrapper/Localizations/ru-RU/tooltip_Windows_11.json +++ b/Wrapper/Localizations/ru-RU/tooltip_Windows_11.json @@ -1502,7 +1502,7 @@ { "Id": 803, "Region": "UWP apps", - "Function": "HEIF", + "Function": "HEVC", "Arg": { "Zero": { "Tag": "Manually", diff --git a/src/Sophia_Script_for_Windows_10/Module/Sophia.psm1 b/src/Sophia_Script_for_Windows_10/Module/Sophia.psm1 index 61d94eb0..08675e4c 100644 --- a/src/Sophia_Script_for_Windows_10/Module/Sophia.psm1 +++ b/src/Sophia_Script_for_Windows_10/Module/Sophia.psm1 @@ -4451,7 +4451,7 @@ function OneDrive $UserEmail = Get-ItemProperty -Path HKCU:\Software\Microsoft\OneDrive\Accounts\Personal -Name UserEmail -ErrorAction Ignore if ($PresetName -and $UserEmail) { - # Exit if user accidentelly set function in preset to uninstall but he's logged into the app + # Exit if user accidentally set function in preset to uninstall but he's logged into the app return } @@ -9280,8 +9280,12 @@ function InstallVCRedist if ([System.Version](Get-AppxPackage -Name Microsoft.DesktopAppInstaller -ErrorAction Ignore).Version -ge [System.Version]"1.17") { + # https://github.com/microsoft/winget-pkgs/tree/master/manifests/m/Microsoft/VCRedist/2015%2B winget install --id=Microsoft.VCRedist.2015+.x86 --exact --accept-source-agreements winget install --id=Microsoft.VCRedist.2015+.x64 --exact --accept-source-agreements + + # PowerShell 5.1 (7.3 too) interprets 8.3 file name literally, if an environment variable contains a non-latin word + Get-ChildItem -Path "$env:TEMP\WinGet" -Force -ErrorAction Ignore | Remove-Item -Recurse -Force -ErrorAction Ignore } else { @@ -9311,8 +9315,7 @@ function InstallVCRedist "$DownloadsFolder\VC_redist.x86.exe", "$DownloadsFolder\VC_redist.x64.exe", "$env:TEMP\dd_vcredist_x86_*.log", - "$env:TEMP\dd_vcredist_amd64_*.log", - "$env:TEMP\WinGet" + "$env:TEMP\dd_vcredist_amd64_*.log" ) Get-ChildItem -Path $Paths -Recurse -Force | Remove-Item -Recurse -Force -ErrorAction Ignore } @@ -9357,15 +9360,20 @@ function InstallDotNetRuntimes if ([System.Version](Get-AppxPackage -Name Microsoft.DesktopAppInstaller -ErrorAction Ignore).Version -ge [System.Version]"1.17") { + # https://github.com/microsoft/winget-pkgs/tree/master/manifests/m/Microsoft/DotNet/DesktopRuntime/6 # .NET Desktop Runtime 6 x86 winget install --id=Microsoft.DotNet.DesktopRuntime.6 --architecture x86 --exact --accept-source-agreements - # .NET Desktop Runtime 7 x64 + # .NET Desktop Runtime 6 x64 winget install --id=Microsoft.DotNet.DesktopRuntime.6 --architecture x64 --exact --accept-source-agreements + # https://github.com/microsoft/winget-pkgs/tree/master/manifests/m/Microsoft/DotNet/DesktopRuntime/7 # .NET Desktop Runtime 7 x86 winget install --id=Microsoft.DotNet.DesktopRuntime.7 --architecture x86 --exact --accept-source-agreements # .NET Desktop Runtime 7 x64 winget install --id=Microsoft.DotNet.DesktopRuntime.7 --architecture x64 --exact --accept-source-agreements + + # PowerShell 5.1 (7.3 too) interprets 8.3 file name literally, if an environment variable contains a non-latin word + Get-ChildItem -Path "$env:TEMP\WinGet" -Force -ErrorAction Ignore | Remove-Item -Recurse -Force -ErrorAction Ignore } else { @@ -9631,11 +9639,11 @@ function PreventEdgeShortcutCreation .SYNOPSIS Windows Subsystem for Linux (WSL) - .PARAMETER Install + .PARAMETER Enable Windows Subsystem for Linux (WSL), install the latest WSL Linux kernel version, and a Linux distribution using a pop-up form .EXAMPLE - WSL + Install-WSL .NOTES The "Receive updates for other Microsoft products" setting will be enabled automatically to receive kernel updates @@ -9643,8 +9651,17 @@ function PreventEdgeShortcutCreation .NOTES Machine-wide #> -function WSL +function Install-WSL { + [System.Console]::OutputEncoding = [System.Text.Encoding]::Unicode + + $Distros = (wsl --list --online | Select-Object -Skip 8).Replace(" ", "").Replace("* ", "") | ForEach-Object -Process { + [PSCustomObject]@{ + "Distro" = $_ -split " ", 2 | Select-Object -Last 1 + "Alias" = $_ -split " ", 2 | Select-Object -First 1 + } + } + Add-Type -AssemblyName PresentationCore, PresentationFramework #region Variables @@ -9658,19 +9675,12 @@ function WSL xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" Name="Window" Title="WSL" - MinHeight="400" MinWidth="350" + MinHeight="460" MinWidth="350" SizeToContent="WidthAndHeight" WindowStartupLocation="CenterScreen" TextOptions.TextFormattingMode="Display" SnapsToDevicePixels="True" FontFamily="Candara" FontSize="16" ShowInTaskbar="True" Background="#F1F1F1" Foreground="#262626"> - - - - -