diff --git a/Flow.Launcher.Infrastructure/UserSettings/Settings.cs b/Flow.Launcher.Infrastructure/UserSettings/Settings.cs index 8ecd6dc4b..9d9a2e7a9 100644 --- a/Flow.Launcher.Infrastructure/UserSettings/Settings.cs +++ b/Flow.Launcher.Infrastructure/UserSettings/Settings.cs @@ -205,6 +205,7 @@ namespace Flow.Launcher.Infrastructure.UserSettings // This needs to be loaded last by staying at the bottom public PluginsSettings PluginSettings { get; set; } = new PluginsSettings(); + internal List ShortCuts { get; set; } = new List(); } public enum LastQueryMode diff --git a/Flow.Launcher.Infrastructure/UserSettings/ShortCutModel.cs b/Flow.Launcher.Infrastructure/UserSettings/ShortCutModel.cs new file mode 100644 index 000000000..5853dbbb4 --- /dev/null +++ b/Flow.Launcher.Infrastructure/UserSettings/ShortCutModel.cs @@ -0,0 +1,12 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace Flow.Launcher.Infrastructure.UserSettings +{ + public record ShortCutModel(string Key, string Value) + { + } +} diff --git a/Flow.Launcher/SettingWindow.xaml b/Flow.Launcher/SettingWindow.xaml index 967e4d52b..0cb2343bc 100644 --- a/Flow.Launcher/SettingWindow.xaml +++ b/Flow.Launcher/SettingWindow.xaml @@ -875,6 +875,31 @@ SelectedValuePath="LanguageCode" /> + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/Flow.Launcher/ViewModel/MainViewModel.cs b/Flow.Launcher/ViewModel/MainViewModel.cs index 0fe3bdf80..7706db614 100644 --- a/Flow.Launcher/ViewModel/MainViewModel.cs +++ b/Flow.Launcher/ViewModel/MainViewModel.cs @@ -553,6 +553,16 @@ namespace Flow.Launcher.ViewModel return; } + string query = QueryText; + + foreach (var shortcut in _settings.ShortCuts) + { + if (QueryText == shortcut.Key) + { + query = shortcut.Value; + } + } + _updateSource?.Dispose(); var currentUpdateSource = new CancellationTokenSource(); @@ -569,7 +579,7 @@ namespace Flow.Launcher.ViewModel if (currentCancellationToken.IsCancellationRequested) return; - var query = QueryBuilder.Build(QueryText.Trim(), PluginManager.NonGlobalPlugins); + var query = QueryBuilder.Build(query.Trim(), PluginManager.NonGlobalPlugins); // handle the exclusiveness of plugin using action keyword RemoveOldQueryResults(query); diff --git a/Flow.Launcher/ViewModel/SettingWindowViewModel.cs b/Flow.Launcher/ViewModel/SettingWindowViewModel.cs index 2fc6934d5..2096b43c6 100644 --- a/Flow.Launcher/ViewModel/SettingWindowViewModel.cs +++ b/Flow.Launcher/ViewModel/SettingWindowViewModel.cs @@ -170,6 +170,8 @@ namespace Flow.Launcher.ViewModel public List Languages => _translater.LoadAvailableLanguages(); public IEnumerable MaxResultsRange => Enumerable.Range(2, 16); + public List ShortCuts => Settings.ShortCuts; + public string TestProxy() { var proxyServer = Settings.Proxy.Server;