From 3d20a602df9459fc746613b60380c35751afa987 Mon Sep 17 00:00:00 2001 From: Vic <10308169+VictoriousRaptor@users.noreply.github.com> Date: Wed, 5 Oct 2022 19:55:49 +0800 Subject: [PATCH 01/14] Rename ShortcutModel to CustomShortcutModel --- .../UserSettings/Settings.cs | 14 +++++++------- Flow.Launcher/CustomShortcutSetting.xaml.cs | 2 +- Flow.Launcher/ViewModel/MainViewModel.cs | 2 +- Flow.Launcher/ViewModel/SettingWindowViewModel.cs | 4 ++-- 4 files changed, 11 insertions(+), 11 deletions(-) diff --git a/Flow.Launcher.Infrastructure/UserSettings/Settings.cs b/Flow.Launcher.Infrastructure/UserSettings/Settings.cs index b56989e7d..871317bd3 100644 --- a/Flow.Launcher.Infrastructure/UserSettings/Settings.cs +++ b/Flow.Launcher.Infrastructure/UserSettings/Settings.cs @@ -204,7 +204,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 ObservableCollection ShortCuts { get; set; } = new(); + internal ObservableCollection ShortCuts { get; set; } = new(); } public enum LastQueryMode @@ -221,12 +221,12 @@ namespace Flow.Launcher.Infrastructure.UserSettings Dark } - public struct ShortCutModel + public struct CustomShortcutModel { public string Key { get; set; } public string Value { get; set; } - public ShortCutModel(string key, string value) + public CustomShortcutModel(string key, string value) { Key = key; Value = value; @@ -234,7 +234,7 @@ namespace Flow.Launcher.Infrastructure.UserSettings public override bool Equals(object obj) { - return obj is ShortCutModel other && + return obj is CustomShortcutModel other && Key == other.Key && Value == other.Value; } @@ -250,14 +250,14 @@ namespace Flow.Launcher.Infrastructure.UserSettings value = Value; } - public static implicit operator (string Key, string Value)(ShortCutModel value) + public static implicit operator (string Key, string Value)(CustomShortcutModel value) { return (value.Key, value.Value); } - public static implicit operator ShortCutModel((string Key, string Value) value) + public static implicit operator CustomShortcutModel((string Key, string Value) value) { - return new ShortCutModel(value.Key, value.Value); + return new CustomShortcutModel(value.Key, value.Value); } } } diff --git a/Flow.Launcher/CustomShortcutSetting.xaml.cs b/Flow.Launcher/CustomShortcutSetting.xaml.cs index feea064a4..ce16981d8 100644 --- a/Flow.Launcher/CustomShortcutSetting.xaml.cs +++ b/Flow.Launcher/CustomShortcutSetting.xaml.cs @@ -19,7 +19,7 @@ namespace Flow.Launcher public string Key { get; set; } public string Value { get; set; } - public ShortCutModel ShortCut => (Key, Value); + public CustomShortcutModel ShortCut => (Key, Value); public CustomShortcutSetting() { InitializeComponent(); diff --git a/Flow.Launcher/ViewModel/MainViewModel.cs b/Flow.Launcher/ViewModel/MainViewModel.cs index 25458f278..134e85d28 100644 --- a/Flow.Launcher/ViewModel/MainViewModel.cs +++ b/Flow.Launcher/ViewModel/MainViewModel.cs @@ -662,7 +662,7 @@ namespace Flow.Launcher.ViewModel } } - private static Query ConstructQuery(string queryText, IEnumerable shortcuts) + private static Query ConstructQuery(string queryText, IEnumerable shortcuts) { StringBuilder queryBuilder = new(queryText); diff --git a/Flow.Launcher/ViewModel/SettingWindowViewModel.cs b/Flow.Launcher/ViewModel/SettingWindowViewModel.cs index bee0419d9..1f088a869 100644 --- a/Flow.Launcher/ViewModel/SettingWindowViewModel.cs +++ b/Flow.Launcher/ViewModel/SettingWindowViewModel.cs @@ -180,7 +180,7 @@ namespace Flow.Launcher.ViewModel public List Languages => _translater.LoadAvailableLanguages(); public IEnumerable MaxResultsRange => Enumerable.Range(2, 16); - public ObservableCollection ShortCuts => Settings.ShortCuts; + public ObservableCollection ShortCuts => Settings.ShortCuts; public string TestProxy() { @@ -541,7 +541,7 @@ namespace Flow.Launcher.ViewModel public CustomPluginHotkey SelectedCustomPluginHotkey { get; set; } - public ShortCutModel? SelectedCustomShortcut { get; set; } + public CustomShortcutModel? SelectedCustomShortcut { get; set; } public int? SelectCustomShortcutIndex { get; set; } #endregion From 099b1d6ed172073ef7d2d4adebecf8e38e59b83d Mon Sep 17 00:00:00 2001 From: Vic <10308169+VictoriousRaptor@users.noreply.github.com> Date: Wed, 5 Oct 2022 20:08:14 +0800 Subject: [PATCH 02/14] Rename Settings.ShortCuts to CustomShortcuts --- Flow.Launcher.Infrastructure/UserSettings/Settings.cs | 2 +- Flow.Launcher/SettingWindow.xaml.cs | 6 +++--- Flow.Launcher/ViewModel/MainViewModel.cs | 2 +- Flow.Launcher/ViewModel/SettingWindowViewModel.cs | 2 +- 4 files changed, 6 insertions(+), 6 deletions(-) diff --git a/Flow.Launcher.Infrastructure/UserSettings/Settings.cs b/Flow.Launcher.Infrastructure/UserSettings/Settings.cs index 871317bd3..872af4560 100644 --- a/Flow.Launcher.Infrastructure/UserSettings/Settings.cs +++ b/Flow.Launcher.Infrastructure/UserSettings/Settings.cs @@ -204,7 +204,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 ObservableCollection ShortCuts { get; set; } = new(); + internal ObservableCollection CustomShortcuts { get; set; } = new(); } public enum LastQueryMode diff --git a/Flow.Launcher/SettingWindow.xaml.cs b/Flow.Launcher/SettingWindow.xaml.cs index e21af2bea..10a69f572 100644 --- a/Flow.Launcher/SettingWindow.xaml.cs +++ b/Flow.Launcher/SettingWindow.xaml.cs @@ -386,7 +386,7 @@ namespace Flow.Launcher MessageBox.Show(deleteWarning, InternationalizationManager.Instance.GetTranslation("delete"), MessageBoxButton.YesNo) == MessageBoxResult.Yes) { - settings.ShortCuts.Remove(item.Value); + settings.CustomShortcuts.Remove(item.Value); } } private void OnEditCustomShortCutClick(object sender, RoutedEventArgs e) @@ -397,7 +397,7 @@ namespace Flow.Launcher var shortcutSettingWindow = new CustomShortcutSetting(item.Value); if (shortcutSettingWindow.ShowDialog() == true) { - settings.ShortCuts[viewModel.SelectCustomShortcutIndex.Value] = shortcutSettingWindow.ShortCut; + settings.CustomShortcuts[viewModel.SelectCustomShortcutIndex.Value] = shortcutSettingWindow.ShortCut; } } else @@ -411,7 +411,7 @@ namespace Flow.Launcher var shortcutSettingWindow = new CustomShortcutSetting(); if (shortcutSettingWindow.ShowDialog() == true) { - settings.ShortCuts.Add(shortcutSettingWindow.ShortCut); + settings.CustomShortcuts.Add(shortcutSettingWindow.ShortCut); } } } diff --git a/Flow.Launcher/ViewModel/MainViewModel.cs b/Flow.Launcher/ViewModel/MainViewModel.cs index 134e85d28..c42bfb9c6 100644 --- a/Flow.Launcher/ViewModel/MainViewModel.cs +++ b/Flow.Launcher/ViewModel/MainViewModel.cs @@ -554,7 +554,7 @@ namespace Flow.Launcher.ViewModel return; } - var query = ConstructQuery(QueryText, _settings.ShortCuts); + var query = ConstructQuery(QueryText, _settings.CustomShortcuts); _updateSource?.Dispose(); diff --git a/Flow.Launcher/ViewModel/SettingWindowViewModel.cs b/Flow.Launcher/ViewModel/SettingWindowViewModel.cs index 1f088a869..e9976177f 100644 --- a/Flow.Launcher/ViewModel/SettingWindowViewModel.cs +++ b/Flow.Launcher/ViewModel/SettingWindowViewModel.cs @@ -180,7 +180,7 @@ namespace Flow.Launcher.ViewModel public List Languages => _translater.LoadAvailableLanguages(); public IEnumerable MaxResultsRange => Enumerable.Range(2, 16); - public ObservableCollection ShortCuts => Settings.ShortCuts; + public ObservableCollection ShortCuts => Settings.CustomShortcuts; public string TestProxy() { From 99d18077f39c678dd77997bb318d73c75d0e4686 Mon Sep 17 00:00:00 2001 From: Vic <10308169+VictoriousRaptor@users.noreply.github.com> Date: Thu, 6 Oct 2022 02:20:51 +0800 Subject: [PATCH 03/14] Move CustomShortcutModel definition to a new file 1. Move CustomShortcutModel definition to a new file 2. Some other minor tweaks --- .../UserSettings/CustomShortcutModel.cs | 48 +++++++++++++++++++ .../UserSettings/Settings.cs | 40 ---------------- Flow.Launcher/CustomShortcutSetting.xaml.cs | 2 +- Flow.Launcher/SettingWindow.xaml.cs | 11 ++++- 4 files changed, 58 insertions(+), 43 deletions(-) create mode 100644 Flow.Launcher.Infrastructure/UserSettings/CustomShortcutModel.cs diff --git a/Flow.Launcher.Infrastructure/UserSettings/CustomShortcutModel.cs b/Flow.Launcher.Infrastructure/UserSettings/CustomShortcutModel.cs new file mode 100644 index 000000000..750adf9ee --- /dev/null +++ b/Flow.Launcher.Infrastructure/UserSettings/CustomShortcutModel.cs @@ -0,0 +1,48 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace Flow.Launcher.Infrastructure.UserSettings +{ + public class CustomShortcutModel + { + public string Key { get; set; } + public string Value { get; set; } + + public CustomShortcutModel(string key, string value) + { + Key = key; + Value = value; + } + + public override bool Equals(object obj) + { + return obj is CustomShortcutModel other && + Key == other.Key && + Value == other.Value; + } + + public override int GetHashCode() + { + return HashCode.Combine(Key, Value); + } + + public void Deconstruct(out string key, out string value) + { + key = Key; + value = Value; + } + + public static implicit operator (string Key, string Value)(CustomShortcutModel shortcut) + { + return (shortcut.Key, shortcut.Value); + } + + public static implicit operator CustomShortcutModel((string Key, string Value) shortcut) + { + return new CustomShortcutModel(shortcut.Key, shortcut.Value); + } + } +} diff --git a/Flow.Launcher.Infrastructure/UserSettings/Settings.cs b/Flow.Launcher.Infrastructure/UserSettings/Settings.cs index 872af4560..8feba325c 100644 --- a/Flow.Launcher.Infrastructure/UserSettings/Settings.cs +++ b/Flow.Launcher.Infrastructure/UserSettings/Settings.cs @@ -220,44 +220,4 @@ namespace Flow.Launcher.Infrastructure.UserSettings Light, Dark } - - public struct CustomShortcutModel - { - public string Key { get; set; } - public string Value { get; set; } - - public CustomShortcutModel(string key, string value) - { - Key = key; - Value = value; - } - - public override bool Equals(object obj) - { - return obj is CustomShortcutModel other && - Key == other.Key && - Value == other.Value; - } - - public override int GetHashCode() - { - return HashCode.Combine(Key, Value); - } - - public void Deconstruct(out string key, out string value) - { - key = Key; - value = Value; - } - - public static implicit operator (string Key, string Value)(CustomShortcutModel value) - { - return (value.Key, value.Value); - } - - public static implicit operator CustomShortcutModel((string Key, string Value) value) - { - return new CustomShortcutModel(value.Key, value.Value); - } - } } diff --git a/Flow.Launcher/CustomShortcutSetting.xaml.cs b/Flow.Launcher/CustomShortcutSetting.xaml.cs index ce16981d8..2a03d483b 100644 --- a/Flow.Launcher/CustomShortcutSetting.xaml.cs +++ b/Flow.Launcher/CustomShortcutSetting.xaml.cs @@ -14,12 +14,12 @@ namespace Flow.Launcher { private SettingWindow _settingWidow; private bool update; - private CustomPluginHotkey updateCustomHotkey; private Settings _settings; public string Key { get; set; } public string Value { get; set; } public CustomShortcutModel ShortCut => (Key, Value); + public CustomShortcutSetting() { InitializeComponent(); diff --git a/Flow.Launcher/SettingWindow.xaml.cs b/Flow.Launcher/SettingWindow.xaml.cs index 10a69f572..2db00f959 100644 --- a/Flow.Launcher/SettingWindow.xaml.cs +++ b/Flow.Launcher/SettingWindow.xaml.cs @@ -365,11 +365,14 @@ namespace Flow.Launcher restoreButton.Visibility = Visibility.Collapsed; } } + private void Window_StateChanged(object sender, EventArgs e) { RefreshMaximizeRestoreButton(); } + #region Shortcut + private void OnDeleteCustomShortCutClick(object sender, RoutedEventArgs e) { var item = viewModel.SelectedCustomShortcut; @@ -386,15 +389,16 @@ namespace Flow.Launcher MessageBox.Show(deleteWarning, InternationalizationManager.Instance.GetTranslation("delete"), MessageBoxButton.YesNo) == MessageBoxResult.Yes) { - settings.CustomShortcuts.Remove(item.Value); + settings.CustomShortcuts.Remove(item); } } + private void OnEditCustomShortCutClick(object sender, RoutedEventArgs e) { var item = viewModel.SelectedCustomShortcut; if (item != null) { - var shortcutSettingWindow = new CustomShortcutSetting(item.Value); + var shortcutSettingWindow = new CustomShortcutSetting(item); if (shortcutSettingWindow.ShowDialog() == true) { settings.CustomShortcuts[viewModel.SelectCustomShortcutIndex.Value] = shortcutSettingWindow.ShortCut; @@ -414,5 +418,8 @@ namespace Flow.Launcher settings.CustomShortcuts.Add(shortcutSettingWindow.ShortCut); } } + + #endregion + } } From a0c70a34324897b3d7803e621bbf1b9b278e339e Mon Sep 17 00:00:00 2001 From: Vic <10308169+VictoriousRaptor@users.noreply.github.com> Date: Sat, 8 Oct 2022 16:33:39 +0800 Subject: [PATCH 04/14] Inherit --- .../UserSettings/CustomShortcutModel.cs | 45 +++++++++++-------- 1 file changed, 26 insertions(+), 19 deletions(-) diff --git a/Flow.Launcher.Infrastructure/UserSettings/CustomShortcutModel.cs b/Flow.Launcher.Infrastructure/UserSettings/CustomShortcutModel.cs index 750adf9ee..9df2633bc 100644 --- a/Flow.Launcher.Infrastructure/UserSettings/CustomShortcutModel.cs +++ b/Flow.Launcher.Infrastructure/UserSettings/CustomShortcutModel.cs @@ -1,15 +1,34 @@ using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using System.Threading.Tasks; +using System.Text.Json.Serialization; namespace Flow.Launcher.Infrastructure.UserSettings { - public class CustomShortcutModel + public class CustomShortcutBaseModel { public string Key { get; set; } - public string Value { get; set; } + + [JsonIgnore] + public Func Expand { get; set; } = () => { return ""; }; + + public override bool Equals(object obj) + { + return obj is CustomShortcutBaseModel other && + Key == other.Key; + } + + public override int GetHashCode() + { + return HashCode.Combine(Key); + } + }; + + public class CustomShortcutModel : CustomShortcutBaseModel + { + public string Value + { + get { return Expand(); } + set { Expand = () => { return value; }; } + } public CustomShortcutModel(string key, string value) { @@ -17,22 +36,10 @@ namespace Flow.Launcher.Infrastructure.UserSettings Value = value; } - public override bool Equals(object obj) - { - return obj is CustomShortcutModel other && - Key == other.Key && - Value == other.Value; - } - - public override int GetHashCode() - { - return HashCode.Combine(Key, Value); - } - public void Deconstruct(out string key, out string value) { key = Key; - value = Value; + value = Expand(); } public static implicit operator (string Key, string Value)(CustomShortcutModel shortcut) From c2b14815e30334c8d0563b60d7ffb4fda82a86c7 Mon Sep 17 00:00:00 2001 From: Vic <10308169+VictoriousRaptor@users.noreply.github.com> Date: Sat, 8 Oct 2022 16:40:48 +0800 Subject: [PATCH 05/14] Warn if trying to add existing shortcut 1. Warn if trying to add existing shortcut --- Flow.Launcher.Infrastructure/UserSettings/Settings.cs | 2 +- Flow.Launcher/SettingWindow.xaml.cs | 5 +++++ 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/Flow.Launcher.Infrastructure/UserSettings/Settings.cs b/Flow.Launcher.Infrastructure/UserSettings/Settings.cs index 8feba325c..c9b76c2f5 100644 --- a/Flow.Launcher.Infrastructure/UserSettings/Settings.cs +++ b/Flow.Launcher.Infrastructure/UserSettings/Settings.cs @@ -175,6 +175,7 @@ namespace Flow.Launcher.Infrastructure.UserSettings public ObservableCollection CustomPluginHotkeys { get; set; } = new ObservableCollection(); + public ObservableCollection CustomShortcuts { get; set; } = new ObservableCollection(); public bool DontPromptUpdateMsg { get; set; } public bool EnableUpdateLog { get; set; } @@ -204,7 +205,6 @@ namespace Flow.Launcher.Infrastructure.UserSettings // This needs to be loaded last by staying at the bottom public PluginsSettings PluginSettings { get; set; } = new PluginsSettings(); - internal ObservableCollection CustomShortcuts { get; set; } = new(); } public enum LastQueryMode diff --git a/Flow.Launcher/SettingWindow.xaml.cs b/Flow.Launcher/SettingWindow.xaml.cs index 2db00f959..f896af4a0 100644 --- a/Flow.Launcher/SettingWindow.xaml.cs +++ b/Flow.Launcher/SettingWindow.xaml.cs @@ -415,6 +415,11 @@ namespace Flow.Launcher var shortcutSettingWindow = new CustomShortcutSetting(); if (shortcutSettingWindow.ShowDialog() == true) { + if (settings.CustomShortcuts.Contains(shortcutSettingWindow.ShortCut)) + { + MessageBox.Show("Dulplicate shortcut"); + return; + } settings.CustomShortcuts.Add(shortcutSettingWindow.ShortCut); } } From e78994874a64bc2b6b5470901cd2136b0f1ba54f Mon Sep 17 00:00:00 2001 From: Vic <10308169+VictoriousRaptor@users.noreply.github.com> Date: Sat, 8 Oct 2022 17:01:18 +0800 Subject: [PATCH 06/14] Text update --- Flow.Launcher/CustomShortcutSetting.xaml | 6 +++--- Flow.Launcher/CustomShortcutSetting.xaml.cs | 20 +++++++++++++------- Flow.Launcher/Languages/en.xaml | 14 +++++++++++--- Flow.Launcher/SettingWindow.xaml | 4 ++-- Flow.Launcher/SettingWindow.xaml.cs | 5 ----- 5 files changed, 29 insertions(+), 20 deletions(-) diff --git a/Flow.Launcher/CustomShortcutSetting.xaml b/Flow.Launcher/CustomShortcutSetting.xaml index 839836b6a..89268437b 100644 --- a/Flow.Launcher/CustomShortcutSetting.xaml +++ b/Flow.Launcher/CustomShortcutSetting.xaml @@ -3,7 +3,7 @@ xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" xmlns:flowlauncher="clr-namespace:Flow.Launcher" - Title="{DynamicResource customeQueryHotkeyTitle}" + Title="{DynamicResource customeQueryShortcutTitle}" Width="530" Background="{DynamicResource PopuBGColor}" Foreground="{DynamicResource PopupTextColor}" @@ -67,13 +67,13 @@ FontFamily="Segoe UI" FontSize="20" FontWeight="SemiBold" - Text="{DynamicResource customeQueryHotkeyTitle}" + Text="{DynamicResource customQueryShortcut}" TextAlignment="Left" /> diff --git a/Flow.Launcher/CustomShortcutSetting.xaml.cs b/Flow.Launcher/CustomShortcutSetting.xaml.cs index 2a03d483b..87245d79d 100644 --- a/Flow.Launcher/CustomShortcutSetting.xaml.cs +++ b/Flow.Launcher/CustomShortcutSetting.xaml.cs @@ -1,12 +1,8 @@ -using Flow.Launcher.Core.Resource; -using Flow.Launcher.Helper; -using Flow.Launcher.Infrastructure.UserSettings; -using System.Collections.ObjectModel; -using System.Linq; +using System; using System.Windows; using System.Windows.Input; -using System.Windows.Controls; -using System.Collections.Generic; +using Flow.Launcher.Core.Resource; +using Flow.Launcher.Infrastructure.UserSettings; namespace Flow.Launcher { @@ -40,6 +36,16 @@ namespace Flow.Launcher private void btnAdd_OnClick(object sender, RoutedEventArgs e) { DialogResult = true; + if (_settings.CustomShortcuts.Contains(new CustomShortcutModel(Key, Value))) + { + MessageBox.Show(InternationalizationManager.Instance.GetTranslation("dulplicateShortcut")); + DialogResult = false; + } + else if (String.IsNullOrEmpty(Key) || String.IsNullOrEmpty(Value)) + { + MessageBox.Show(InternationalizationManager.Instance.GetTranslation("invalidShortcut")); + DialogResult = false; + } Close(); } diff --git a/Flow.Launcher/Languages/en.xaml b/Flow.Launcher/Languages/en.xaml index 69c0a73ae..9d34cff28 100644 --- a/Flow.Launcher/Languages/en.xaml +++ b/Flow.Launcher/Languages/en.xaml @@ -113,8 +113,9 @@ Select a modifier key to open selected result via keyboard. Show Hotkey Show result selection hotkey with results. - Custom Query Hotkey - Query + Custom Query Hotkey + Custom Query Shortcut + Query Shortcut Expanded Delete @@ -211,7 +212,14 @@ Invalid plugin hotkey Update - + + Custom Query Shortcut + Enter a shortcut to automatically expand to the specified query. + Preview + Shortcut is dulplicate, please enter a new Shortcut or edit the existing one. + Invalid Shortcut + + Hotkey Unavailable diff --git a/Flow.Launcher/SettingWindow.xaml b/Flow.Launcher/SettingWindow.xaml index 47933f326..9d45e3862 100644 --- a/Flow.Launcher/SettingWindow.xaml +++ b/Flow.Launcher/SettingWindow.xaml @@ -2188,14 +2188,14 @@ Style="{StaticResource {x:Static GridView.GridViewStyleKey}}"> - + - + diff --git a/Flow.Launcher/SettingWindow.xaml.cs b/Flow.Launcher/SettingWindow.xaml.cs index f896af4a0..2db00f959 100644 --- a/Flow.Launcher/SettingWindow.xaml.cs +++ b/Flow.Launcher/SettingWindow.xaml.cs @@ -415,11 +415,6 @@ namespace Flow.Launcher var shortcutSettingWindow = new CustomShortcutSetting(); if (shortcutSettingWindow.ShowDialog() == true) { - if (settings.CustomShortcuts.Contains(shortcutSettingWindow.ShortCut)) - { - MessageBox.Show("Dulplicate shortcut"); - return; - } settings.CustomShortcuts.Add(shortcutSettingWindow.ShortCut); } } From f3c4120395ba2d96a0d6998ce52fe81df8cfb4e2 Mon Sep 17 00:00:00 2001 From: Vic <10308169+VictoriousRaptor@users.noreply.github.com> Date: Sat, 8 Oct 2022 17:52:27 +0800 Subject: [PATCH 07/14] Shortcut settings dialog preview & text & bugfix --- Flow.Launcher/CustomShortcutSetting.xaml | 23 ++++++++++---- Flow.Launcher/CustomShortcutSetting.xaml.cs | 35 +++++++++++++-------- Flow.Launcher/Languages/en.xaml | 1 - Flow.Launcher/SettingWindow.xaml | 2 +- Flow.Launcher/SettingWindow.xaml.cs | 4 +-- 5 files changed, 42 insertions(+), 23 deletions(-) diff --git a/Flow.Launcher/CustomShortcutSetting.xaml b/Flow.Launcher/CustomShortcutSetting.xaml index 89268437b..1c87cfbe8 100644 --- a/Flow.Launcher/CustomShortcutSetting.xaml +++ b/Flow.Launcher/CustomShortcutSetting.xaml @@ -110,14 +110,25 @@ VerticalAlignment="Center" FontSize="14" Text="{DynamicResource customShortcutExpansion}" /> - - + LastChildFill="True"> + diff --git a/Flow.Launcher/CustomShortcutSetting.xaml.cs b/Flow.Launcher/CustomShortcutSetting.xaml.cs index 25ce82424..292288473 100644 --- a/Flow.Launcher/CustomShortcutSetting.xaml.cs +++ b/Flow.Launcher/CustomShortcutSetting.xaml.cs @@ -34,9 +34,9 @@ namespace Flow.Launcher Close(); } - private void btnAdd_OnClick(object sender, RoutedEventArgs e) + private void BtnAdd_OnClick(object sender, RoutedEventArgs e) { - if (!update && _settings.CustomShortcuts.Contains(new CustomShortcutModel(Key, Value))) + if (!update && (_settings.CustomShortcuts.Contains(new CustomShortcutModel(Key, Value)) || _settings.BuiltinShortcuts.Contains(new CustomShortcutModel(Key, Value)))) { MessageBox.Show(InternationalizationManager.Instance.GetTranslation("dulplicateShortcut")); return; diff --git a/Flow.Launcher/SettingWindow.xaml b/Flow.Launcher/SettingWindow.xaml index dc290ccd6..f15de6afe 100644 --- a/Flow.Launcher/SettingWindow.xaml +++ b/Flow.Launcher/SettingWindow.xaml @@ -2223,7 +2223,7 @@