From 33d5a741e7dc95291b5ffcdc205587a3316f50d8 Mon Sep 17 00:00:00 2001 From: Jeremy Date: Thu, 2 Jan 2025 20:30:06 +1100 Subject: [PATCH] use WPF Control hotkey display --- Flow.Launcher.Infrastructure/Hotkey/HotkeyModel.cs | 5 +++-- Flow.Launcher/HotkeyControlDialog.xaml.cs | 2 -- 2 files changed, 3 insertions(+), 4 deletions(-) diff --git a/Flow.Launcher.Infrastructure/Hotkey/HotkeyModel.cs b/Flow.Launcher.Infrastructure/Hotkey/HotkeyModel.cs index b2f6ee719..a6037a81d 100644 --- a/Flow.Launcher.Infrastructure/Hotkey/HotkeyModel.cs +++ b/Flow.Launcher.Infrastructure/Hotkey/HotkeyModel.cs @@ -187,6 +187,7 @@ namespace Flow.Launcher.Infrastructure.Hotkey } } + // WPF Control hotkey form i.e. simplified text e.g. LeftAlt+X -> Alt + X, includes space around '+' public readonly string ToWPFHotkeyString() { var hotkey = string.Empty; @@ -220,9 +221,9 @@ namespace Flow.Launcher.Infrastructure.Hotkey return hotkey; } - public IEnumerable EnumerateDisplayKeys() => !string.IsNullOrEmpty(HotkeyRaw) ? HotkeyRaw.Split('+') : Array.Empty(); + // Display in the form of WPF Control i.e. simplified text e.g. LeftAlt -> Alt + public IEnumerable EnumerateDisplayKeys() => !string.IsNullOrEmpty(HotkeyRaw) ? ToWPFHotkeyString().Split(" + ") : Array.Empty(); - //For WPF hotkey control public string FromWPFKeysToString() => string.Join("+", EnumerateWPFKeys()); public IEnumerable EnumerateWPFKeys() diff --git a/Flow.Launcher/HotkeyControlDialog.xaml.cs b/Flow.Launcher/HotkeyControlDialog.xaml.cs index e4a2d8cad..13734a831 100644 --- a/Flow.Launcher/HotkeyControlDialog.xaml.cs +++ b/Flow.Launcher/HotkeyControlDialog.xaml.cs @@ -161,8 +161,6 @@ public partial class HotkeyControlDialog : ContentDialog return; } - IEnumerable enumerateMethod; - foreach (var key in hotkey.Value.EnumerateDisplayKeys()!) { KeysToDisplay.Add(key);