Skip to content

Commit bade0fc

Browse files
Merge pull request #1669 from VictoriousRaptor/DisablePATHByDefault
Add option to enable/disable UWP indexing
2 parents b3f5dc0 + 2d32b33 commit bade0fc

File tree

6 files changed

+41
-11
lines changed

6 files changed

+41
-11
lines changed

Plugins/Flow.Launcher.Plugin.Program/Languages/en.xaml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,8 @@
2222
<system:String x:Key="flowlauncher_plugin_program_indexing">Indexing</system:String>
2323
<system:String x:Key="flowlauncher_plugin_program_index_source">Index Sources</system:String>
2424
<system:String x:Key="flowlauncher_plugin_program_index_option">Options</system:String>
25+
<system:String x:Key="flowlauncher_plugin_program_index_uwp">UWP Apps</system:String>
26+
<system:String x:Key="flowlauncher_plugin_program_index_uwp_tooltip">When enabled, Flow will load UWP Applications</system:String>
2527
<system:String x:Key="flowlauncher_plugin_program_index_start">Start Menu</system:String>
2628
<system:String x:Key="flowlauncher_plugin_program_index_start_tooltip">When enabled, Flow will load programs from the start menu</system:String>
2729
<system:String x:Key="flowlauncher_plugin_program_index_registry">Registry</system:String>

Plugins/Flow.Launcher.Plugin.Program/Main.cs

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,6 @@
55
using System.Threading;
66
using System.Threading.Tasks;
77
using System.Windows.Controls;
8-
using Flow.Launcher.Infrastructure;
98
using Flow.Launcher.Infrastructure.Logger;
109
using Flow.Launcher.Infrastructure.Storage;
1110
using Flow.Launcher.Plugin.Program.Programs;
@@ -115,9 +114,7 @@ public static void IndexWin32Programs()
115114

116115
public static void IndexUwpPrograms()
117116
{
118-
var windows10 = new Version(10, 0);
119-
var support = Environment.OSVersion.Version.Major >= windows10.Major;
120-
var applications = support ? UWP.All() : Array.Empty<UWP.Application>();
117+
var applications = UWP.All(_settings);
121118
_uwps = applications;
122119
ResetCache();
123120
}

Plugins/Flow.Launcher.Plugin.Program/Programs/UWP.cs

Lines changed: 10 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -199,11 +199,10 @@ private PackageVersion GetPackageVersionFromManifest(XmlNode xmlRoot)
199199
},
200200
};
201201

202-
public static Application[] All()
202+
public static Application[] All(Settings settings)
203203
{
204-
var windows10 = new Version(10, 0);
205-
var support = Environment.OSVersion.Version.Major >= windows10.Major;
206-
if (support)
204+
var support = SupportUWP();
205+
if (support && settings.EnableUWP)
207206
{
208207
var applications = CurrentUserPackages().AsParallel().SelectMany(p =>
209208
{
@@ -241,6 +240,13 @@ public static Application[] All()
241240
}
242241
}
243242

243+
public static bool SupportUWP()
244+
{
245+
var windows10 = new Version(10, 0);
246+
var support = Environment.OSVersion.Version.Major >= windows10.Major;
247+
return support;
248+
}
249+
244250
private static IEnumerable<Package> CurrentUserPackages()
245251
{
246252
var u = WindowsIdentity.GetCurrent().User;

Plugins/Flow.Launcher.Plugin.Program/Settings.cs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -119,6 +119,7 @@ private void RemoveRedundantSuffixes()
119119
public bool HideAppsPath { get; set; } = true;
120120
public bool EnableRegistrySource { get; set; } = true;
121121
public bool EnablePathSource { get; set; } = false;
122+
public bool EnableUWP { get; set; } = true;
122123

123124
public string CustomizedExplorer { get; set; } = Explorer;
124125
public string CustomizedArgs { get; set; } = ExplorerArgs;

Plugins/Flow.Launcher.Plugin.Program/Views/ProgramSetting.xaml

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,9 @@
77
Height="520"
88
DataContext="{Binding RelativeSource={RelativeSource Self}}"
99
mc:Ignorable="d">
10+
<UserControl.Resources>
11+
<BooleanToVisibilityConverter x:Key="BooleanToVisibilityConverter"/>
12+
</UserControl.Resources>
1013
<Grid Margin="0">
1114
<Grid.RowDefinitions>
1215
<RowDefinition Height="Auto" />
@@ -27,6 +30,13 @@
2730
Margin="0,0,14,0"
2831
HorizontalAlignment="Right"
2932
DockPanel.Dock="Right">
33+
<CheckBox
34+
Name="UWPEnabled"
35+
Margin="12,0,12,0"
36+
Visibility="{Binding ShowUWPCheckbox, Converter={StaticResource BooleanToVisibilityConverter}}"
37+
Content="{DynamicResource flowlauncher_plugin_program_index_uwp}"
38+
IsChecked="{Binding EnableUWP}"
39+
ToolTip="{DynamicResource flowlauncher_plugin_program_index_uwp_tooltip}" />
3040
<CheckBox
3141
Name="StartMenuEnabled"
3242
Margin="12,0,12,0"
@@ -39,7 +49,6 @@
3949
Content="{DynamicResource flowlauncher_plugin_program_index_registry}"
4050
IsChecked="{Binding EnableRegistrySource}"
4151
ToolTip="{DynamicResource flowlauncher_plugin_program_index_registry_tooltip}" />
42-
4352
<CheckBox
4453
Name="PATHEnabled"
4554
Margin="12,0,12,0"

Plugins/Flow.Launcher.Plugin.Program/Views/ProgramSetting.xaml.cs

Lines changed: 17 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -77,6 +77,16 @@ public bool EnablePATHSource
7777
}
7878
}
7979

80+
public bool EnableUWP
81+
{
82+
get => _settings.EnableUWP;
83+
set
84+
{
85+
_settings.EnableUWP = value;
86+
ReIndexing();
87+
}
88+
}
89+
8090
public string CustomizedExplorerPath
8191
{
8292
get => _settings.CustomizedExplorer;
@@ -89,6 +99,8 @@ public string CustomizedExplorerArg
8999
set => _settings.CustomizedArgs = value;
90100
}
91101

102+
public bool ShowUWPCheckbox => UWP.SupportUWP();
103+
92104
public ProgramSetting(PluginInitContext context, Settings settings, Win32[] win32s, UWP.Application[] uwps)
93105
{
94106
this.context = context;
@@ -383,8 +395,11 @@ private void programSourceView_SelectionChanged(object sender, SelectionChangedE
383395

384396
private void programSourceView_MouseDoubleClick(object sender, MouseButtonEventArgs e)
385397
{
386-
var selectedProgramSource = programSourceView.SelectedItem as ProgramSource;
387-
EditProgramSource(selectedProgramSource);
398+
if (((FrameworkElement)e.OriginalSource).DataContext is ProgramSource)
399+
{
400+
var selectedProgramSource = programSourceView.SelectedItem as ProgramSource;
401+
EditProgramSource(selectedProgramSource);
402+
}
388403
}
389404

390405
private bool IsAllItemsUserAdded(List<ProgramSource> items)

0 commit comments

Comments
 (0)