From 4055e305388e2f1e58b370962e245bad2862f51a Mon Sep 17 00:00:00 2001 From: Jack251970 <1160210343@qq.com> Date: Sun, 6 Jul 2025 20:52:36 +0800 Subject: [PATCH] Use set hotkey function instead of setter --- .../Hotkey/RegisteredHotkeyData.cs | 11 ++++++++++- Flow.Launcher/Helper/HotKeyMapper.cs | 4 ++-- 2 files changed, 12 insertions(+), 3 deletions(-) diff --git a/Flow.Launcher.Infrastructure/Hotkey/RegisteredHotkeyData.cs b/Flow.Launcher.Infrastructure/Hotkey/RegisteredHotkeyData.cs index 591d3c000..befd49318 100644 --- a/Flow.Launcher.Infrastructure/Hotkey/RegisteredHotkeyData.cs +++ b/Flow.Launcher.Infrastructure/Hotkey/RegisteredHotkeyData.cs @@ -26,7 +26,7 @@ public record RegisteredHotkeyData /// /// representation of this hotkey. /// - public HotkeyModel Hotkey { get; set; } + public HotkeyModel Hotkey { get; private set; } /// /// String key in the localization dictionary that represents this hotkey. For example, ReloadPluginHotkey, @@ -233,6 +233,15 @@ public record RegisteredHotkeyData RemoveHotkey = removeHotkey; } + /// + /// Sets the hotkey for this registered hotkey data. + /// + /// + public void SetHotkey(HotkeyModel hotkey) + { + Hotkey = hotkey; + } + /// public override string ToString() { diff --git a/Flow.Launcher/Helper/HotKeyMapper.cs b/Flow.Launcher/Helper/HotKeyMapper.cs index 8a7919590..93be0f42a 100644 --- a/Flow.Launcher/Helper/HotKeyMapper.cs +++ b/Flow.Launcher/Helper/HotKeyMapper.cs @@ -260,7 +260,7 @@ internal static class HotKeyMapper { var hotkeyData = SearchRegisteredHotkeyData(metadata, globalPluginHotkey); RemoveHotkey(hotkeyData); - hotkeyData.Hotkey = newHotkey; + hotkeyData.SetHotkey(newHotkey); SetHotkey(hotkeyData); } else if (pluginHotkey is SearchWindowPluginHotkey) @@ -591,7 +591,7 @@ internal static class HotKeyMapper RemoveHotkey(registeredHotkeyData); // Update the hotkey string - registeredHotkeyData.Hotkey = newHotkey; + registeredHotkeyData.SetHotkey(newHotkey); // Set the new hotkey SetHotkey(registeredHotkeyData);