diff --git a/Plugins/Flow.Launcher.Plugin.Program/Languages/en.xaml b/Plugins/Flow.Launcher.Plugin.Program/Languages/en.xaml index 8d642b60053..fb663f1a4b5 100644 --- a/Plugins/Flow.Launcher.Plugin.Program/Languages/en.xaml +++ b/Plugins/Flow.Launcher.Plugin.Program/Languages/en.xaml @@ -22,6 +22,8 @@ Indexing Index Sources Options + UWP Apps + When enabled, Flow will load UWP Applications Start Menu When enabled, Flow will load programs from the start menu Registry diff --git a/Plugins/Flow.Launcher.Plugin.Program/Main.cs b/Plugins/Flow.Launcher.Plugin.Program/Main.cs index c94c1dca2a9..340d882dac4 100644 --- a/Plugins/Flow.Launcher.Plugin.Program/Main.cs +++ b/Plugins/Flow.Launcher.Plugin.Program/Main.cs @@ -5,7 +5,6 @@ using System.Threading; using System.Threading.Tasks; using System.Windows.Controls; -using Flow.Launcher.Infrastructure; using Flow.Launcher.Infrastructure.Logger; using Flow.Launcher.Infrastructure.Storage; using Flow.Launcher.Plugin.Program.Programs; @@ -115,9 +114,7 @@ public static void IndexWin32Programs() public static void IndexUwpPrograms() { - var windows10 = new Version(10, 0); - var support = Environment.OSVersion.Version.Major >= windows10.Major; - var applications = support ? UWP.All() : Array.Empty(); + var applications = UWP.All(_settings); _uwps = applications; ResetCache(); } diff --git a/Plugins/Flow.Launcher.Plugin.Program/Programs/UWP.cs b/Plugins/Flow.Launcher.Plugin.Program/Programs/UWP.cs index 28641dd003c..d0070f83374 100644 --- a/Plugins/Flow.Launcher.Plugin.Program/Programs/UWP.cs +++ b/Plugins/Flow.Launcher.Plugin.Program/Programs/UWP.cs @@ -199,11 +199,10 @@ private PackageVersion GetPackageVersionFromManifest(XmlNode xmlRoot) }, }; - public static Application[] All() + public static Application[] All(Settings settings) { - var windows10 = new Version(10, 0); - var support = Environment.OSVersion.Version.Major >= windows10.Major; - if (support) + var support = SupportUWP(); + if (support && settings.EnableUWP) { var applications = CurrentUserPackages().AsParallel().SelectMany(p => { @@ -241,6 +240,13 @@ public static Application[] All() } } + public static bool SupportUWP() + { + var windows10 = new Version(10, 0); + var support = Environment.OSVersion.Version.Major >= windows10.Major; + return support; + } + private static IEnumerable CurrentUserPackages() { var u = WindowsIdentity.GetCurrent().User; diff --git a/Plugins/Flow.Launcher.Plugin.Program/Settings.cs b/Plugins/Flow.Launcher.Plugin.Program/Settings.cs index 34da42f1f48..f59facaa4ac 100644 --- a/Plugins/Flow.Launcher.Plugin.Program/Settings.cs +++ b/Plugins/Flow.Launcher.Plugin.Program/Settings.cs @@ -119,6 +119,7 @@ private void RemoveRedundantSuffixes() public bool HideAppsPath { get; set; } = true; public bool EnableRegistrySource { get; set; } = true; public bool EnablePathSource { get; set; } = false; + public bool EnableUWP { get; set; } = true; public string CustomizedExplorer { get; set; } = Explorer; public string CustomizedArgs { get; set; } = ExplorerArgs; diff --git a/Plugins/Flow.Launcher.Plugin.Program/Views/ProgramSetting.xaml b/Plugins/Flow.Launcher.Plugin.Program/Views/ProgramSetting.xaml index 957042de5d3..fa97de4f26e 100644 --- a/Plugins/Flow.Launcher.Plugin.Program/Views/ProgramSetting.xaml +++ b/Plugins/Flow.Launcher.Plugin.Program/Views/ProgramSetting.xaml @@ -7,6 +7,9 @@ Height="520" DataContext="{Binding RelativeSource={RelativeSource Self}}" mc:Ignorable="d"> + + + @@ -27,6 +30,13 @@ Margin="0,0,14,0" HorizontalAlignment="Right" DockPanel.Dock="Right"> + - _settings.EnableUWP; + set + { + _settings.EnableUWP = value; + ReIndexing(); + } + } + public string CustomizedExplorerPath { get => _settings.CustomizedExplorer; @@ -89,6 +99,8 @@ public string CustomizedExplorerArg set => _settings.CustomizedArgs = value; } + public bool ShowUWPCheckbox => UWP.SupportUWP(); + public ProgramSetting(PluginInitContext context, Settings settings, Win32[] win32s, UWP.Application[] uwps) { this.context = context; @@ -383,8 +395,11 @@ private void programSourceView_SelectionChanged(object sender, SelectionChangedE private void programSourceView_MouseDoubleClick(object sender, MouseButtonEventArgs e) { - var selectedProgramSource = programSourceView.SelectedItem as ProgramSource; - EditProgramSource(selectedProgramSource); + if (((FrameworkElement)e.OriginalSource).DataContext is ProgramSource) + { + var selectedProgramSource = programSourceView.SelectedItem as ProgramSource; + EditProgramSource(selectedProgramSource); + } } private bool IsAllItemsUserAdded(List items)