Skip to content

Commit

Permalink
[CmdNotFound]Disable on Arm64 as there is no MSI installer for PowerS…
Browse files Browse the repository at this point in the history
…hell 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>
  • Loading branch information
3 people committed Jan 5, 2024
1 parent a7907ff commit f6a6358
Show file tree
Hide file tree
Showing 3 changed files with 48 additions and 28 deletions.
45 changes: 28 additions & 17 deletions src/settings-ui/Settings.UI/SettingsXAML/Views/CmdNotFoundPage.xaml
Expand Up @@ -17,7 +17,10 @@
TrueValue="Collapsed" />
<toolkitConverters:BoolToVisibilityConverter x:Key="BoolToVisibilityConverter" />
</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>
<StackPanel ChildrenTransitions="{StaticResource SettingsCardsAnimations}" Orientation="Vertical">
<InfoBar
Expand Down Expand Up @@ -56,24 +59,32 @@
</controls:Case>
</controls:SwitchPresenter>
<controls:SettingsExpander.ItemsHeader>
<InfoBar
x:Uid="CmdNotFound_RequirementsBar"
BorderThickness="0"
CornerRadius="0"
IsClosable="False"
IsOpen="True">
<InfoBar.ActionButton>
<HyperlinkButton x:Uid="CmdNotFound_CheckCompatibility" Command="{x:Bind ViewModel.CheckRequirementsEventHandler}">
<ToolTipService.ToolTip>
<TextBlock x:Uid="CmdNotFound_CheckCompatibilityTooltip" TextWrapping="Wrap" />
</ToolTipService.ToolTip>
</HyperlinkButton>
</InfoBar.ActionButton>
</InfoBar>
<StackPanel>
<InfoBar
x:Uid="CmdNotFound_RequirementsBar"
BorderThickness="0"
CornerRadius="0"
IsClosable="False"
IsOpen="{x:Bind Mode=OneWay, Path=ViewModel.IsArm64Arch, Converter={StaticResource BoolNegationConverter}}">
<InfoBar.ActionButton>
<HyperlinkButton x:Uid="CmdNotFound_CheckCompatibility" Command="{x:Bind ViewModel.CheckRequirementsEventHandler}">
<ToolTipService.ToolTip>
<TextBlock x:Uid="CmdNotFound_CheckCompatibilityTooltip" TextWrapping="Wrap" />
</ToolTipService.ToolTip>
</HyperlinkButton>
</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.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:Case Value="True">
<StackPanel Orientation="Horizontal" Spacing="8">
Expand Down Expand Up @@ -104,7 +115,7 @@
</controls:SwitchPresenter>
</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:Case Value="True">
<StackPanel Orientation="Horizontal" Spacing="8">
Expand Down
25 changes: 14 additions & 11 deletions src/settings-ui/Settings.UI/Strings/en-us/Resources.resw
Expand Up @@ -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>
<comment>"Command Not Found" is a product name</comment>
</data>
<data name="InstalledLabel.Text" xml:space="preserve">
<data name="InstalledLabel.Text" xml:space="preserve">
<value>Installed</value>
</data>
<data name="DetectedLabel.Text" xml:space="preserve">
<data name="DetectedLabel.Text" xml:space="preserve">
<value>Detected</value>
</data>
<data name="NotDetectedLabel.Text" xml:space="preserve">
<data name="NotDetectedLabel.Text" xml:space="preserve">
<value>Not detected</value>
</data>
<data name="CmdNotFound_RequirementsBar.Title" xml:space="preserve">
<data name="CmdNotFound_RequirementsBar.Title" xml:space="preserve">
<value>The following components are required</value>
</data>
<data name="CmdNotFound_PowerShellDetection.Header" xml:space="preserve">
Expand All @@ -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">
<value>WinGet Client PowerShell module</value>
</data>
<data name="CmdNotFound_Enable.Header" xml:space="preserve">
<data name="CmdNotFound_Enable.Header" xml:space="preserve">
<value>Command Not Found</value>
<comment>"Command Not Found" is a product name</comment>
</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>
</data>
<data name="CmdNotFound_ModuleInstallationLogs.Text" xml:space="preserve">
Expand All @@ -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">
<value>PowerShell 7 is required to use this module</value>
</data>
<data name="CmdNotFound_CheckCompatibility.Content" xml:space="preserve">
<data name="CmdNotFound_CheckCompatibility.Content" xml:space="preserve">
<value>Refresh</value>
</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>
</data>
<data name="CmdNotFound_InstallButton.Content" xml:space="preserve">
<data name="CmdNotFound_InstallButton.Content" xml:space="preserve">
<value>Install</value>
</data>
<data name="CmdNotFound_UninstallButton.Content" xml:space="preserve">
<data name="CmdNotFound_UninstallButton.Content" xml:space="preserve">
<value>Uninstall</value>
</data>
<data name="Oobe_CmdNotFound.Description" xml:space="preserve">
Expand Down Expand Up @@ -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">
<value>Text size of result titles</value>
</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>
Expand Up @@ -6,6 +6,7 @@
using System.Diagnostics;
using System.IO;
using System.Reflection;
using System.Runtime.InteropServices;
using global::PowerToys.GPOWrapper;
using ManagedCommon;
using Microsoft.PowerToys.Settings.UI.Library.Helpers;
Expand Down Expand Up @@ -123,6 +124,11 @@ public bool IsEnabledGpoConfigured
get => _enabledStateIsGPOConfigured;
}

public bool IsArm64Arch
{
get => RuntimeInformation.OSArchitecture == System.Runtime.InteropServices.Architecture.Arm64;
}

public string RunPowerShellScript(string powershellExecutable, string powershellArguments, bool hidePowerShellWindow = false)
{
string outputLog = string.Empty;
Expand Down

0 comments on commit f6a6358

Please sign in to comment.