[CmdNotFound]Disable on Arm64 as there is no MSI installer for PowerShell 7.4 yet (#30759)

* [Command Not Found] Disable on Arm64

* Hide deps

* Update src/settings-ui/Settings.UI/Strings/en-us/Resources.resw

Co-authored-by: Jaime Bernardo <jaime@janeasystems.com>

* Update Resources.resw

---------

Co-authored-by: Jaime Bernardo <jaime@janeasystems.com>
Co-authored-by: Clint Rutkas <clint@rutkas.com>
This commit is contained in:
Stefan Markovic
2024-01-05 20:46:34 +01:00
committed by GitHub
parent a7907ff63a
commit f6a63582a2
3 changed files with 48 additions and 28 deletions

View File

@@ -17,7 +17,10 @@
TrueValue="Collapsed" /> TrueValue="Collapsed" />
<toolkitConverters:BoolToVisibilityConverter x:Key="BoolToVisibilityConverter" /> <toolkitConverters:BoolToVisibilityConverter x:Key="BoolToVisibilityConverter" />
</Page.Resources> </Page.Resources>
<custom:SettingsPageControl x:Uid="CmdNotFound" ModuleImageSource="ms-appx:///Assets/Settings/Modules/CmdNotFound.png"> <custom:SettingsPageControl
x:Uid="CmdNotFound"
IsEnabled="{x:Bind Mode=OneWay, Path=ViewModel.IsArm64Arch, Converter={StaticResource BoolNegationConverter}}"
ModuleImageSource="ms-appx:///Assets/Settings/Modules/CmdNotFound.png">
<custom:SettingsPageControl.ModuleContent> <custom:SettingsPageControl.ModuleContent>
<StackPanel ChildrenTransitions="{StaticResource SettingsCardsAnimations}" Orientation="Vertical"> <StackPanel ChildrenTransitions="{StaticResource SettingsCardsAnimations}" Orientation="Vertical">
<InfoBar <InfoBar
@@ -56,24 +59,32 @@
</controls:Case> </controls:Case>
</controls:SwitchPresenter> </controls:SwitchPresenter>
<controls:SettingsExpander.ItemsHeader> <controls:SettingsExpander.ItemsHeader>
<InfoBar <StackPanel>
x:Uid="CmdNotFound_RequirementsBar" <InfoBar
BorderThickness="0" x:Uid="CmdNotFound_RequirementsBar"
CornerRadius="0" BorderThickness="0"
IsClosable="False" CornerRadius="0"
IsOpen="True"> IsClosable="False"
<InfoBar.ActionButton> IsOpen="{x:Bind Mode=OneWay, Path=ViewModel.IsArm64Arch, Converter={StaticResource BoolNegationConverter}}">
<HyperlinkButton x:Uid="CmdNotFound_CheckCompatibility" Command="{x:Bind ViewModel.CheckRequirementsEventHandler}"> <InfoBar.ActionButton>
<ToolTipService.ToolTip> <HyperlinkButton x:Uid="CmdNotFound_CheckCompatibility" Command="{x:Bind ViewModel.CheckRequirementsEventHandler}">
<TextBlock x:Uid="CmdNotFound_CheckCompatibilityTooltip" TextWrapping="Wrap" /> <ToolTipService.ToolTip>
</ToolTipService.ToolTip> <TextBlock x:Uid="CmdNotFound_CheckCompatibilityTooltip" TextWrapping="Wrap" />
</HyperlinkButton> </ToolTipService.ToolTip>
</InfoBar.ActionButton> </HyperlinkButton>
</InfoBar> </InfoBar.ActionButton>
</InfoBar>
<InfoBar
x:Uid="CmdNotFound_Arm64ArchBar"
BorderThickness="0"
CornerRadius="0"
IsClosable="False"
IsOpen="{x:Bind Mode=OneWay, Path=ViewModel.IsArm64Arch}" />
</StackPanel>
</controls:SettingsExpander.ItemsHeader> </controls:SettingsExpander.ItemsHeader>
<controls:SettingsExpander.Items> <controls:SettingsExpander.Items>
<controls:SettingsCard x:Uid="CmdNotFound_PowerShellDetection"> <controls:SettingsCard x:Uid="CmdNotFound_PowerShellDetection" Visibility="{x:Bind Mode=OneWay, Path=ViewModel.IsArm64Arch, Converter={StaticResource BoolToInvertedVisibilityConverter}}">
<controls:SwitchPresenter TargetType="x:Boolean" Value="{x:Bind ViewModel.IsPowerShell7Detected, Mode=OneWay}"> <controls:SwitchPresenter TargetType="x:Boolean" Value="{x:Bind ViewModel.IsPowerShell7Detected, Mode=OneWay}">
<controls:Case Value="True"> <controls:Case Value="True">
<StackPanel Orientation="Horizontal" Spacing="8"> <StackPanel Orientation="Horizontal" Spacing="8">
@@ -104,7 +115,7 @@
</controls:SwitchPresenter> </controls:SwitchPresenter>
</controls:SettingsCard> </controls:SettingsCard>
<controls:SettingsCard x:Uid="CmdNotFound_WinGetClientDetection"> <controls:SettingsCard x:Uid="CmdNotFound_WinGetClientDetection" Visibility="{x:Bind Mode=OneWay, Path=ViewModel.IsArm64Arch, Converter={StaticResource BoolToInvertedVisibilityConverter}}">
<controls:SwitchPresenter TargetType="x:Boolean" Value="{x:Bind ViewModel.IsWinGetClientModuleDetected, Mode=OneWay}"> <controls:SwitchPresenter TargetType="x:Boolean" Value="{x:Bind ViewModel.IsWinGetClientModuleDetected, Mode=OneWay}">
<controls:Case Value="True"> <controls:Case Value="True">
<StackPanel Orientation="Horizontal" Spacing="8"> <StackPanel Orientation="Horizontal" Spacing="8">

View File

@@ -3677,16 +3677,16 @@ Activate by holding the key for the character you want to add an accent to, then
<value>Command Not Found</value> <value>Command Not Found</value>
<comment>"Command Not Found" is a product name</comment> <comment>"Command Not Found" is a product name</comment>
</data> </data>
<data name="InstalledLabel.Text" xml:space="preserve"> <data name="InstalledLabel.Text" xml:space="preserve">
<value>Installed</value> <value>Installed</value>
</data> </data>
<data name="DetectedLabel.Text" xml:space="preserve"> <data name="DetectedLabel.Text" xml:space="preserve">
<value>Detected</value> <value>Detected</value>
</data> </data>
<data name="NotDetectedLabel.Text" xml:space="preserve"> <data name="NotDetectedLabel.Text" xml:space="preserve">
<value>Not detected</value> <value>Not detected</value>
</data> </data>
<data name="CmdNotFound_RequirementsBar.Title" xml:space="preserve"> <data name="CmdNotFound_RequirementsBar.Title" xml:space="preserve">
<value>The following components are required</value> <value>The following components are required</value>
</data> </data>
<data name="CmdNotFound_PowerShellDetection.Header" xml:space="preserve"> <data name="CmdNotFound_PowerShellDetection.Header" xml:space="preserve">
@@ -3695,11 +3695,11 @@ Activate by holding the key for the character you want to add an accent to, then
<data name="CmdNotFound_WinGetClientDetection.Header" xml:space="preserve"> <data name="CmdNotFound_WinGetClientDetection.Header" xml:space="preserve">
<value>WinGet Client PowerShell module</value> <value>WinGet Client PowerShell module</value>
</data> </data>
<data name="CmdNotFound_Enable.Header" xml:space="preserve"> <data name="CmdNotFound_Enable.Header" xml:space="preserve">
<value>Command Not Found</value> <value>Command Not Found</value>
<comment>"Command Not Found" is a product name</comment> <comment>"Command Not Found" is a product name</comment>
</data> </data>
<data name="CmdNotFound_Enable.Description" xml:space="preserve"> <data name="CmdNotFound_Enable.Description" xml:space="preserve">
<value>Add this module to the PowerShell 7 profile script so that it is enabled with every new session</value> <value>Add this module to the PowerShell 7 profile script so that it is enabled with every new session</value>
</data> </data>
<data name="CmdNotFound_ModuleInstallationLogs.Text" xml:space="preserve"> <data name="CmdNotFound_ModuleInstallationLogs.Text" xml:space="preserve">
@@ -3708,16 +3708,16 @@ Activate by holding the key for the character you want to add an accent to, then
<data name="CmdNotFound_CheckPowerShellVersionButtonControl.Description" xml:space="preserve"> <data name="CmdNotFound_CheckPowerShellVersionButtonControl.Description" xml:space="preserve">
<value>PowerShell 7 is required to use this module</value> <value>PowerShell 7 is required to use this module</value>
</data> </data>
<data name="CmdNotFound_CheckCompatibility.Content" xml:space="preserve"> <data name="CmdNotFound_CheckCompatibility.Content" xml:space="preserve">
<value>Refresh</value> <value>Refresh</value>
</data> </data>
<data name="CmdNotFound_CheckCompatibilityTooltip.Text" xml:space="preserve"> <data name="CmdNotFound_CheckCompatibilityTooltip.Text" xml:space="preserve">
<value>Check if your PowerShell configuration is compatible and configured correctly</value> <value>Check if your PowerShell configuration is compatible and configured correctly</value>
</data> </data>
<data name="CmdNotFound_InstallButton.Content" xml:space="preserve"> <data name="CmdNotFound_InstallButton.Content" xml:space="preserve">
<value>Install</value> <value>Install</value>
</data> </data>
<data name="CmdNotFound_UninstallButton.Content" xml:space="preserve"> <data name="CmdNotFound_UninstallButton.Content" xml:space="preserve">
<value>Uninstall</value> <value>Uninstall</value>
</data> </data>
<data name="Oobe_CmdNotFound.Description" xml:space="preserve"> <data name="Oobe_CmdNotFound.Description" xml:space="preserve">
@@ -3998,4 +3998,7 @@ Activate by holding the key for the character you want to add an accent to, then
<data name="PowerLauncher_TextFontSizeSlider.[using:Microsoft.UI.Xaml.Automation]AutomationProperties.Name" xml:space="preserve"> <data name="PowerLauncher_TextFontSizeSlider.[using:Microsoft.UI.Xaml.Automation]AutomationProperties.Name" xml:space="preserve">
<value>Text size of result titles</value> <value>Text size of result titles</value>
</data> </data>
</root> <data name="CmdNotFound_Arm64ArchBar.Title" xml:space="preserve">
<value>Command Not Found is not supported on the ARM64 architecture currently. We are actively working on a solution.</value>
</data>
</root>

View File

@@ -6,6 +6,7 @@ using System;
using System.Diagnostics; using System.Diagnostics;
using System.IO; using System.IO;
using System.Reflection; using System.Reflection;
using System.Runtime.InteropServices;
using global::PowerToys.GPOWrapper; using global::PowerToys.GPOWrapper;
using ManagedCommon; using ManagedCommon;
using Microsoft.PowerToys.Settings.UI.Library.Helpers; using Microsoft.PowerToys.Settings.UI.Library.Helpers;
@@ -123,6 +124,11 @@ namespace Microsoft.PowerToys.Settings.UI.ViewModels
get => _enabledStateIsGPOConfigured; get => _enabledStateIsGPOConfigured;
} }
public bool IsArm64Arch
{
get => RuntimeInformation.OSArchitecture == System.Runtime.InteropServices.Architecture.Arm64;
}
public string RunPowerShellScript(string powershellExecutable, string powershellArguments, bool hidePowerShellWindow = false) public string RunPowerShellScript(string powershellExecutable, string powershellArguments, bool hidePowerShellWindow = false)
{ {
string outputLog = string.Empty; string outputLog = string.Empty;