diff --git a/Plugins/Flow.Launcher.Plugin.Program/Languages/en.xaml b/Plugins/Flow.Launcher.Plugin.Program/Languages/en.xaml
index c266aa6f6..ce84aa65b 100644
--- a/Plugins/Flow.Launcher.Plugin.Program/Languages/en.xaml
+++ b/Plugins/Flow.Launcher.Plugin.Program/Languages/en.xaml
@@ -14,6 +14,7 @@
Indexing
Index Start Menu
Index Registry
+ Enable Program Description
Suffixes
Max Depth
diff --git a/Plugins/Flow.Launcher.Plugin.Program/Languages/zh-cn.xaml b/Plugins/Flow.Launcher.Plugin.Program/Languages/zh-cn.xaml
index 7771cdf82..8632abb68 100644
--- a/Plugins/Flow.Launcher.Plugin.Program/Languages/zh-cn.xaml
+++ b/Plugins/Flow.Launcher.Plugin.Program/Languages/zh-cn.xaml
@@ -14,6 +14,7 @@
索引中
索引开始菜单
索引注册表
+ 启用程序描述
后缀
最大深度
diff --git a/Plugins/Flow.Launcher.Plugin.Program/Programs/UWP.cs b/Plugins/Flow.Launcher.Plugin.Program/Programs/UWP.cs
index 0aebc9e34..89d6dcc7d 100644
--- a/Plugins/Flow.Launcher.Plugin.Program/Programs/UWP.cs
+++ b/Plugins/Flow.Launcher.Plugin.Program/Programs/UWP.cs
@@ -63,14 +63,14 @@ namespace Flow.Launcher.Plugin.Program.Programs
if (hResult == Hresult.Ok)
{
var apps = new List();
-
+
List _apps = _helper.getAppsFromManifest(stream);
- foreach(var _app in _apps)
+ foreach (var _app in _apps)
{
var app = new Application(_app, this);
apps.Add(app);
}
-
+
Apps = apps.Where(a => a.AppListEntry != "none").ToArray();
}
else
@@ -275,7 +275,7 @@ namespace Flow.Launcher.Plugin.Program.Programs
MatchResult matchResult;
// We suppose Name won't be null
- if (Description == null || Name.StartsWith(Description))
+ if (!Main._settings.EnableDescription || Description == null || Name.StartsWith(Description))
{
title = Name;
matchResult = StringMatcher.FuzzySearch(query, title);
diff --git a/Plugins/Flow.Launcher.Plugin.Program/Programs/Win32.cs b/Plugins/Flow.Launcher.Plugin.Program/Programs/Win32.cs
index 773d0c6b6..931cfacc1 100644
--- a/Plugins/Flow.Launcher.Plugin.Program/Programs/Win32.cs
+++ b/Plugins/Flow.Launcher.Plugin.Program/Programs/Win32.cs
@@ -54,51 +54,43 @@ namespace Flow.Launcher.Plugin.Program.Programs
public Result Result(string query, IPublicAPI api)
{
string title;
-
- var nameMatchResult = StringMatcher.FuzzySearch(query, Name);
- var descriptionMatchResult = StringMatcher.FuzzySearch(query, Description);
-
- var pathMatchResult = new MatchResult(false, 0, new List(), 0);
- if (ExecutableName != null) // only lnk program will need this one
- pathMatchResult = StringMatcher.FuzzySearch(query, ExecutableName);
-
- MatchResult matchResult = nameMatchResult;
-
- if (nameMatchResult.Score < descriptionMatchResult.Score)
- matchResult = descriptionMatchResult;
-
- if (!matchResult.IsSearchPrecisionScoreMet())
- {
- if (pathMatchResult.IsSearchPrecisionScoreMet())
- matchResult = pathMatchResult;
- else return null;
- }
+ MatchResult matchResult;
// We suppose Name won't be null
- if (Description == null || Name.StartsWith(Description))
+ if (!Main._settings.EnableDescription || Description == null || Name.StartsWith(Description))
{
title = Name;
+ matchResult = StringMatcher.FuzzySearch(query, title);
}
else if (Description.StartsWith(Name))
{
title = Description;
+ matchResult = StringMatcher.FuzzySearch(query, Description);
}
else
{
title = $"{Name}: {Description}";
-
- if (matchResult == descriptionMatchResult)
+ var nameMatch = StringMatcher.FuzzySearch(query, Name);
+ var desciptionMatch = StringMatcher.FuzzySearch(query, Description);
+ if (desciptionMatch.Score > nameMatch.Score)
{
- for (int i = 0; i < descriptionMatchResult.MatchData.Count; i++)
+ for (int i = 0; i < desciptionMatch.MatchData.Count; i++)
{
- matchResult.MatchData[i] += Name.Length + 2; // 2 is ": "
+ desciptionMatch.MatchData[i] += Name.Length + 2; // 2 is ": "
}
+ matchResult = desciptionMatch;
}
+ else matchResult = nameMatch;
}
- if (matchResult == pathMatchResult)
+ if (!matchResult.IsSearchPrecisionScoreMet())
{
- // path Match won't have valid highlight data
+ if (ExecutableName != null) // only lnk program will need this one
+ matchResult = StringMatcher.FuzzySearch(query, ExecutableName);
+
+ if (!matchResult.IsSearchPrecisionScoreMet())
+ return null;
+
matchResult.MatchData = new List();
}
diff --git a/Plugins/Flow.Launcher.Plugin.Program/Settings.cs b/Plugins/Flow.Launcher.Plugin.Program/Settings.cs
index 7cb02a852..70e5bd4f5 100644
--- a/Plugins/Flow.Launcher.Plugin.Program/Settings.cs
+++ b/Plugins/Flow.Launcher.Plugin.Program/Settings.cs
@@ -13,6 +13,7 @@ namespace Flow.Launcher.Plugin.Program
public bool EnableStartMenuSource { get; set; } = true;
+ public bool EnableDescription { get; set; } = true;
public bool EnableRegistrySource { 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 90fda1756..45f2a609d 100644
--- a/Plugins/Flow.Launcher.Plugin.Program/Views/ProgramSetting.xaml
+++ b/Plugins/Flow.Launcher.Plugin.Program/Views/ProgramSetting.xaml
@@ -4,19 +4,21 @@
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:program="clr-namespace:Flow.Launcher.Plugin.Program"
+ DataContext="{Binding RelativeSource={RelativeSource Self}}"
mc:Ignorable="d"
d:DesignHeight="404.508" d:DesignWidth="600">
-
+
-
-
-
+
+
+
+
@@ -79,10 +81,10 @@
+ Text="{Binding CustomizedExplorerPath}" x:Name="CustomizeExplorerBox"/>
-
+
diff --git a/Plugins/Flow.Launcher.Plugin.Program/Views/ProgramSetting.xaml.cs b/Plugins/Flow.Launcher.Plugin.Program/Views/ProgramSetting.xaml.cs
index d66ca345e..4c1934e2c 100644
--- a/Plugins/Flow.Launcher.Plugin.Program/Views/ProgramSetting.xaml.cs
+++ b/Plugins/Flow.Launcher.Plugin.Program/Views/ProgramSetting.xaml.cs
@@ -27,12 +27,50 @@ namespace Flow.Launcher.Plugin.Program.Views
// this as temporary holder for displaying all loaded programs sources.
internal static List ProgramSettingDisplayList { get; set; }
+ public bool EnableDescription
+ {
+ get => _settings.EnableDescription;
+ set => _settings.EnableDescription = value;
+ }
+
+ public bool EnableRegistrySource
+ {
+ get => _settings.EnableRegistrySource;
+ set
+ {
+ _settings.EnableRegistrySource = value;
+ ReIndexing();
+ }
+ }
+
+ public bool EnableStartMenuSource
+ {
+ get => _settings.EnableStartMenuSource;
+ set
+ {
+ _settings.EnableStartMenuSource = value;
+ ReIndexing();
+ }
+ }
+
+ public string CustomizedExplorerPath
+ {
+ get => _settings.CustomizedExplorer;
+ set => _settings.CustomizedExplorer = value;
+ }
+
+ public string CustomizedExplorerArg
+ {
+ get => _settings.CustomizedArgs;
+ set => _settings.CustomizedArgs = value;
+ }
+
public ProgramSetting(PluginInitContext context, Settings settings, Win32[] win32s, UWP.Application[] uwps)
{
this.context = context;
- InitializeComponent();
- Loaded += Setting_Loaded;
_settings = settings;
+ Loaded += Setting_Loaded;
+ InitializeComponent();
}
private void Setting_Loaded(object sender, RoutedEventArgs e)
@@ -40,12 +78,6 @@ namespace Flow.Launcher.Plugin.Program.Views
ProgramSettingDisplayList = _settings.ProgramSources.LoadProgramSources();
programSourceView.ItemsSource = ProgramSettingDisplayList;
- StartMenuEnabled.IsChecked = _settings.EnableStartMenuSource;
- RegistryEnabled.IsChecked = _settings.EnableRegistrySource;
-
- CustomizeExplorerBox.Text = _settings.CustomizedExplorer;
- CustomizeArgsBox.Text = _settings.CustomizedArgs;
-
ViewRefresh();
}
@@ -178,18 +210,6 @@ namespace Flow.Launcher.Plugin.Program.Views
}
}
- private void StartMenuEnabled_Click(object sender, RoutedEventArgs e)
- {
- _settings.EnableStartMenuSource = StartMenuEnabled.IsChecked ?? false;
- ReIndexing();
- }
-
- private void RegistryEnabled_Click(object sender, RoutedEventArgs e)
- {
- _settings.EnableRegistrySource = RegistryEnabled.IsChecked ?? false;
- ReIndexing();
- }
-
private void btnLoadAllProgramSource_OnClick(object sender, RoutedEventArgs e)
{
ProgramSettingDisplayList.LoadAllApplications();