From e48a9751d7c20a3f5899d07742448c1653d5c7c2 Mon Sep 17 00:00:00 2001 From: Johan Geluk Date: Wed, 12 Jan 2022 13:21:12 +0100 Subject: [PATCH] Apply invalid hotkey filter to interface hotkeys (#103) --- .../src/Configuration/Classes/InterfaceConfig.cs | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/pass-winmenu/src/Configuration/Classes/InterfaceConfig.cs b/pass-winmenu/src/Configuration/Classes/InterfaceConfig.cs index 88d0f8b..06a4fc8 100644 --- a/pass-winmenu/src/Configuration/Classes/InterfaceConfig.cs +++ b/pass-winmenu/src/Configuration/Classes/InterfaceConfig.cs @@ -1,3 +1,7 @@ +using System.Collections.Generic; +using System.Linq; +using YamlDotNet.Serialization; + namespace PassWinmenu.Configuration { internal class InterfaceConfig @@ -7,7 +11,8 @@ internal class InterfaceConfig public double ClipboardTimeout { get; set; } = 30; public bool RestoreClipboard { get; set; } = true; - public HotkeyConfig[] Hotkeys { get; set; } = + [YamlMember(Alias = "hotkeys")] + public HotkeyConfig[] UnfilteredHotkeys { get; set; } = { new HotkeyConfig { @@ -20,6 +25,12 @@ internal class InterfaceConfig ActionString = "select-previous" } }; + + [YamlIgnore] + public IEnumerable Hotkeys => UnfilteredHotkeys + ?.Where(h => h != null && h.Hotkey != null && h.Options != null) + ?? Enumerable.Empty(); + public PasswordEditorConfig PasswordEditor { get; set; } = new PasswordEditorConfig(); public StyleConfig Style { get; set; } = new StyleConfig(); }