diff --git a/Flow.Launcher/Languages/en.xaml b/Flow.Launcher/Languages/en.xaml
index 7258e3a9106..6232492baf0 100644
--- a/Flow.Launcher/Languages/en.xaml
+++ b/Flow.Launcher/Languages/en.xaml
@@ -36,6 +36,7 @@
Hide tray icon
Query Search Precision
Should Use Pinyin
+ Allows using Pinyin to search. Pinyin is the standard system of romanized spelling for transliterating Chinese
Plugin
diff --git a/Flow.Launcher/SettingWindow.xaml b/Flow.Launcher/SettingWindow.xaml
index 23b741575d3..651d7db09a2 100644
--- a/Flow.Launcher/SettingWindow.xaml
+++ b/Flow.Launcher/SettingWindow.xaml
@@ -63,7 +63,7 @@
-
+
diff --git a/Plugins/Flow.Launcher.Plugin.Shell/Languages/en.xaml b/Plugins/Flow.Launcher.Plugin.Shell/Languages/en.xaml
index 8665e17bb7d..8b312bc93d5 100644
--- a/Plugins/Flow.Launcher.Plugin.Shell/Languages/en.xaml
+++ b/Plugins/Flow.Launcher.Plugin.Shell/Languages/en.xaml
@@ -12,4 +12,5 @@
execute command through command shell
Run As Administrator
Copy the command
+ Only show number of most used commands:
\ No newline at end of file
diff --git a/Plugins/Flow.Launcher.Plugin.Shell/Main.cs b/Plugins/Flow.Launcher.Plugin.Shell/Main.cs
index bd316a6bfd7..4ec1807939f 100644
--- a/Plugins/Flow.Launcher.Plugin.Shell/Main.cs
+++ b/Plugins/Flow.Launcher.Plugin.Shell/Main.cs
@@ -102,7 +102,7 @@ public List Query(Query query)
private List GetHistoryCmds(string cmd, Result result)
{
- IEnumerable history = _settings.Count.Where(o => o.Key.Contains(cmd))
+ IEnumerable history = _settings.CommandHistory.Where(o => o.Key.Contains(cmd))
.OrderByDescending(o => o.Value)
.Select(m =>
{
@@ -124,7 +124,11 @@ private List GetHistoryCmds(string cmd, Result result)
}
};
return ret;
- }).Where(o => o != null).Take(4);
+ }).Where(o => o != null);
+
+ if (_settings.ShowOnlyMostUsedCMDs)
+ return history.Take(_settings.ShowOnlyMostUsedCMDsNumber).ToList();
+
return history.ToList();
}
@@ -148,7 +152,7 @@ private Result GetCurrentCmd(string cmd)
private List ResultsFromlHistory()
{
- IEnumerable history = _settings.Count.OrderByDescending(o => o.Value)
+ IEnumerable history = _settings.CommandHistory.OrderByDescending(o => o.Value)
.Select(m => new Result
{
Title = m.Key,
@@ -159,7 +163,11 @@ private List ResultsFromlHistory()
Execute(Process.Start, PrepareProcessStartInfo(m.Key));
return true;
}
- }).Take(5);
+ });
+
+ if (_settings.ShowOnlyMostUsedCMDs)
+ return history.Take(_settings.ShowOnlyMostUsedCMDsNumber).ToList();
+
return history.ToList();
}
diff --git a/Plugins/Flow.Launcher.Plugin.Shell/Settings.cs b/Plugins/Flow.Launcher.Plugin.Shell/Settings.cs
index 7294630bb5f..042fd0dd39f 100644
--- a/Plugins/Flow.Launcher.Plugin.Shell/Settings.cs
+++ b/Plugins/Flow.Launcher.Plugin.Shell/Settings.cs
@@ -5,21 +5,28 @@ namespace Flow.Launcher.Plugin.Shell
public class Settings
{
public Shell Shell { get; set; } = Shell.Cmd;
+
public bool ReplaceWinR { get; set; } = true;
+
public bool LeaveShellOpen { get; set; }
+
public bool RunAsAdministrator { get; set; } = true;
- public Dictionary Count = new Dictionary();
+ public bool ShowOnlyMostUsedCMDs { get; set; }
+
+ public int ShowOnlyMostUsedCMDsNumber { get; set; }
+
+ public Dictionary CommandHistory { get; set; } = new Dictionary();
public void AddCmdHistory(string cmdName)
{
- if (Count.ContainsKey(cmdName))
+ if (CommandHistory.ContainsKey(cmdName))
{
- Count[cmdName] += 1;
+ CommandHistory[cmdName] += 1;
}
else
{
- Count.Add(cmdName, 1);
+ CommandHistory.Add(cmdName, 1);
}
}
}
diff --git a/Plugins/Flow.Launcher.Plugin.Shell/ShellSetting.xaml b/Plugins/Flow.Launcher.Plugin.Shell/ShellSetting.xaml
index e27297e05ed..4cd4d8fa3a8 100644
--- a/Plugins/Flow.Launcher.Plugin.Shell/ShellSetting.xaml
+++ b/Plugins/Flow.Launcher.Plugin.Shell/ShellSetting.xaml
@@ -12,6 +12,7 @@
+
@@ -21,5 +22,7 @@
PowerShell
RunCommand
+
+
diff --git a/Plugins/Flow.Launcher.Plugin.Shell/ShellSetting.xaml.cs b/Plugins/Flow.Launcher.Plugin.Shell/ShellSetting.xaml.cs
index 82260fcad40..749e9ec80c9 100644
--- a/Plugins/Flow.Launcher.Plugin.Shell/ShellSetting.xaml.cs
+++ b/Plugins/Flow.Launcher.Plugin.Shell/ShellSetting.xaml.cs
@@ -1,4 +1,5 @@
-using System.Windows;
+using System.Collections.Generic;
+using System.Windows;
using System.Windows.Controls;
namespace Flow.Launcher.Plugin.Shell
@@ -16,9 +17,26 @@ public CMDSetting(Settings settings)
private void CMDSetting_OnLoaded(object sender, RoutedEventArgs re)
{
ReplaceWinR.IsChecked = _settings.ReplaceWinR;
+
LeaveShellOpen.IsChecked = _settings.LeaveShellOpen;
+
AlwaysRunAsAdministrator.IsChecked = _settings.RunAsAdministrator;
+
LeaveShellOpen.IsEnabled = _settings.Shell != Shell.RunCommand;
+
+ ShowOnlyMostUsedCMDs.IsChecked = _settings.ShowOnlyMostUsedCMDs;
+
+ if ((bool)!ShowOnlyMostUsedCMDs.IsChecked)
+ ShowOnlyMostUsedCMDsNumber.IsEnabled = false;
+
+ ShowOnlyMostUsedCMDsNumber.ItemsSource = new List() { 5, 10, 20 };
+
+ if (_settings.ShowOnlyMostUsedCMDsNumber == 0)
+ {
+ ShowOnlyMostUsedCMDsNumber.SelectedIndex = 0;
+
+ _settings.ShowOnlyMostUsedCMDsNumber = (int)ShowOnlyMostUsedCMDsNumber.SelectedItem;
+ }
LeaveShellOpen.Checked += (o, e) =>
{
@@ -44,6 +62,7 @@ private void CMDSetting_OnLoaded(object sender, RoutedEventArgs re)
{
_settings.ReplaceWinR = true;
};
+
ReplaceWinR.Unchecked += (o, e) =>
{
_settings.ReplaceWinR = false;
@@ -55,6 +74,27 @@ private void CMDSetting_OnLoaded(object sender, RoutedEventArgs re)
_settings.Shell = (Shell) ShellComboBox.SelectedIndex;
LeaveShellOpen.IsEnabled = _settings.Shell != Shell.RunCommand;
};
+
+ ShowOnlyMostUsedCMDs.Checked += (o, e) =>
+ {
+ _settings.ShowOnlyMostUsedCMDs = true;
+
+ ShowOnlyMostUsedCMDsNumber.IsEnabled = true;
+ };
+
+ ShowOnlyMostUsedCMDs.Unchecked += (o, e) =>
+ {
+ _settings.ShowOnlyMostUsedCMDs = false;
+
+ ShowOnlyMostUsedCMDsNumber.IsEnabled = false;
+ };
+
+ ShowOnlyMostUsedCMDsNumber.SelectedItem = _settings.ShowOnlyMostUsedCMDsNumber;
+ ShowOnlyMostUsedCMDsNumber.SelectionChanged += (o, e) =>
+ {
+ _settings.ShowOnlyMostUsedCMDsNumber = (int)ShowOnlyMostUsedCMDsNumber.SelectedItem;
+ };
+
}
}
}
diff --git a/Plugins/Flow.Launcher.Plugin.Shell/plugin.json b/Plugins/Flow.Launcher.Plugin.Shell/plugin.json
index 592dbdbbd04..80750477463 100644
--- a/Plugins/Flow.Launcher.Plugin.Shell/plugin.json
+++ b/Plugins/Flow.Launcher.Plugin.Shell/plugin.json
@@ -4,7 +4,7 @@
"Name": "Shell",
"Description": "Provide executing commands from Flow Launcher",
"Author": "qianlifeng",
- "Version": "1.2.0",
+ "Version": "1.3.0",
"Language": "csharp",
"Website": "https://github.com/Flow-Launcher/Flow.Launcher",
"ExecuteFileName": "Flow.Launcher.Plugin.Shell.dll",