diff --git a/Flow.Launcher/Flow.Launcher.csproj b/Flow.Launcher/Flow.Launcher.csproj
index 1e7f70b0a..1f979cbdf 100644
--- a/Flow.Launcher/Flow.Launcher.csproj
+++ b/Flow.Launcher/Flow.Launcher.csproj
@@ -116,7 +116,7 @@
-
+
diff --git a/Flow.Launcher/Resources/CustomControlTemplate.xaml b/Flow.Launcher/Resources/CustomControlTemplate.xaml
index 6ab7ab5ad..6e8294031 100644
--- a/Flow.Launcher/Resources/CustomControlTemplate.xaml
+++ b/Flow.Launcher/Resources/CustomControlTemplate.xaml
@@ -2044,31 +2044,43 @@
-
+
-
-
+
+
+
+
+
+
+
@@ -2077,12 +2089,12 @@
-
+
-
+
@@ -2110,7 +2122,7 @@
x:Name="HeaderSite"
MinWidth="0"
MinHeight="0"
- Margin="18,0,0,0"
+ Margin="18,0,18,0"
Padding="{TemplateBinding Padding}"
HorizontalContentAlignment="{TemplateBinding HorizontalContentAlignment}"
VerticalContentAlignment="{TemplateBinding VerticalContentAlignment}"
@@ -2127,19 +2139,62 @@
Foreground="{TemplateBinding Foreground}"
IsChecked="{Binding IsExpanded, Mode=TwoWay, RelativeSource={RelativeSource TemplatedParent}}"
Style="{StaticResource ExpanderDownHeaderStyle}" />
-
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/Flow.Launcher/SettingWindow.xaml b/Flow.Launcher/SettingWindow.xaml
index 950694db5..e50d5be3c 100644
--- a/Flow.Launcher/SettingWindow.xaml
+++ b/Flow.Launcher/SettingWindow.xaml
@@ -48,10 +48,9 @@
-
+
-
+
@@ -95,7 +94,6 @@
-
-
-
-
+
+
+
+
-
+
-
+
+
+
-
+ IsOn="{Binding Settings.ShowOpenResultHotkey}"
+ Style="{DynamicResource SideToggleSwitch}" />
@@ -2590,7 +2647,10 @@
VerticalAlignment="Center"
Style="{DynamicResource SettingTitleLabel}"
Text="{DynamicResource enableProxy}" />
-
+
File Type
Reindex
Indexing
- Index Start Menu
+ Index Sources
+ Options
+ Start Menu
When enabled, Flow will load programs from the start menu
- Index Registry
+ Registry
When enabled, Flow will load programs from the registry
+ PATH
+ When enabled, Flow will load programs from the PATH environment variable
Hide app path
For executable files such as UWP or lnk, hide the file path from being visible
Search in Program Description
diff --git a/Plugins/Flow.Launcher.Plugin.Program/Main.cs b/Plugins/Flow.Launcher.Plugin.Program/Main.cs
index 8126bbf19..c212bf8f4 100644
--- a/Plugins/Flow.Launcher.Plugin.Program/Main.cs
+++ b/Plugins/Flow.Launcher.Plugin.Program/Main.cs
@@ -95,7 +95,7 @@ namespace Flow.Launcher.Plugin.Program
var b = Task.Run(() =>
{
- Stopwatch.Normal("|Flow.Launcher.Plugin.Program.Main|UWPProgram index cost", IndexUwpPrograms);
+ Stopwatch.Normal("|Flow.Launcher.Plugin.Program.Main|UWPPRogram index cost", IndexUwpPrograms);
});
if (cacheEmpty)
diff --git a/Plugins/Flow.Launcher.Plugin.Program/Programs/Win32.cs b/Plugins/Flow.Launcher.Plugin.Program/Programs/Win32.cs
index 3b02d8b63..d739aab0a 100644
--- a/Plugins/Flow.Launcher.Plugin.Program/Programs/Win32.cs
+++ b/Plugins/Flow.Launcher.Plugin.Program/Programs/Win32.cs
@@ -273,6 +273,14 @@ namespace Flow.Launcher.Plugin.Program.Programs
program.Valid = false;
return program;
}
+ catch (FileNotFoundException e)
+ {
+ ProgramLogger.LogException($"|Win32|LnkProgram|{path}" +
+ "|An unexpected error occurred in the calling method LnkProgram", e);
+
+ program.Valid = false;
+ return program;
+ }
#if !DEBUG //Only do a catch all in production. This is so make developer aware of any unhandled exception and add the exception handling in.
catch (Exception e)
{
@@ -343,7 +351,7 @@ namespace Flow.Launcher.Plugin.Program.Programs
}
}
- private static IEnumerable ProgramPaths(string directory, string[] suffixes)
+ private static IEnumerable ProgramPaths(string directory, string[] suffixes, bool recursive = true)
{
if (!Directory.Exists(directory))
return Enumerable.Empty();
@@ -351,7 +359,7 @@ namespace Flow.Launcher.Plugin.Program.Programs
return Directory.EnumerateFiles(directory, "*", new EnumerationOptions
{
IgnoreInaccessible = true,
- RecurseSubdirectories = true
+ RecurseSubdirectories = recursive
}).Where(x => suffixes.Contains(Extension(x)));
}
@@ -394,7 +402,30 @@ namespace Flow.Launcher.Plugin.Program.Programs
return programs;
}
- private static IEnumerable AppPathsPrograms(string[] suffixes, string[] protocols)
+ private static IEnumerable PATHPrograms(string[] suffixes)
+ {
+ var pathEnv = Environment.GetEnvironmentVariable("Path");
+ if (String.IsNullOrEmpty(pathEnv))
+ {
+ return Array.Empty();
+ }
+
+ var paths = pathEnv.Split(";", StringSplitOptions.RemoveEmptyEntries).DistinctBy(p => p.ToLowerInvariant());
+
+ var toFilter = paths.AsParallel().SelectMany(p => ProgramPaths(p, suffixes, recursive: false));
+
+ var programs = ExceptDisabledSource(toFilter.Distinct())
+ .Select(x => Extension(x) switch
+ {
+ ShortcutExtension => LnkProgram(x),
+ UrlExtension => UrlProgram(x),
+ ExeExtension => ExeProgram(x),
+ _ => Win32Program(x)
+ });
+ return programs;
+ }
+
+ private static IEnumerable AppPathsPrograms(string[] suffixes)
{
// https://msdn.microsoft.com/en-us/library/windows/desktop/ee872121
const string appPaths = @"SOFTWARE\Microsoft\Windows\CurrentVersion\App Paths";
@@ -552,6 +583,12 @@ namespace Flow.Launcher.Plugin.Program.Programs
autoIndexPrograms = autoIndexPrograms.Concat(startMenu);
}
+ if (settings.EnablePATHSource)
+ {
+ var path = PATHPrograms(settings.GetSuffixes());
+ autoIndexPrograms = autoIndexPrograms.Concat(path);
+ }
+
autoIndexPrograms = ProgramsHasher(autoIndexPrograms);
return programs.Concat(autoIndexPrograms).Where(x => x.Valid).Distinct().ToArray();
diff --git a/Plugins/Flow.Launcher.Plugin.Program/Settings.cs b/Plugins/Flow.Launcher.Plugin.Program/Settings.cs
index 84cc2e4ee..e3e8b99b9 100644
--- a/Plugins/Flow.Launcher.Plugin.Program/Settings.cs
+++ b/Plugins/Flow.Launcher.Plugin.Program/Settings.cs
@@ -118,6 +118,8 @@ namespace Flow.Launcher.Plugin.Program
public bool EnableDescription { get; set; } = false;
public bool HideAppsPath { get; set; } = true;
public bool EnableRegistrySource { get; set; } = true;
+ public bool EnablePATHSource { 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 171f6081b..227c23ebc 100644
--- a/Plugins/Flow.Launcher.Plugin.Program/Views/ProgramSetting.xaml
+++ b/Plugins/Flow.Launcher.Plugin.Program/Views/ProgramSetting.xaml
@@ -10,58 +10,88 @@
mc:Ignorable="d">
-
+
+
+
+
+
+
+
+
+
+
+
+
-
-
-
-
-
-
-
-
+
+
+
+
-
-
-
+
+
+
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
diff --git a/Plugins/Flow.Launcher.Plugin.Program/Views/ProgramSetting.xaml.cs b/Plugins/Flow.Launcher.Plugin.Program/Views/ProgramSetting.xaml.cs
index 175cb06a6..b8c2bca22 100644
--- a/Plugins/Flow.Launcher.Plugin.Program/Views/ProgramSetting.xaml.cs
+++ b/Plugins/Flow.Launcher.Plugin.Program/Views/ProgramSetting.xaml.cs
@@ -66,6 +66,16 @@ namespace Flow.Launcher.Plugin.Program.Views
}
}
+ public bool EnablePATHSource
+ {
+ get => _settings.EnablePATHSource;
+ set
+ {
+ _settings.EnablePATHSource = value;
+ ReIndexing();
+ }
+ }
+
public string CustomizedExplorerPath
{
get => _settings.CustomizedExplorer;