Skip to content

Commit

Permalink
Apply invalid hotkey filter to interface hotkeys (#103)
Browse files Browse the repository at this point in the history
  • Loading branch information
geluk committed Jan 12, 2022
1 parent 38126b1 commit e48a975
Showing 1 changed file with 12 additions and 1 deletion.
13 changes: 12 additions & 1 deletion pass-winmenu/src/Configuration/Classes/InterfaceConfig.cs
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
using System.Collections.Generic;
using System.Linq;
using YamlDotNet.Serialization;

namespace PassWinmenu.Configuration
{
internal class InterfaceConfig
Expand All @@ -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
{
Expand All @@ -20,6 +25,12 @@ internal class InterfaceConfig
ActionString = "select-previous"
}
};

[YamlIgnore]
public IEnumerable<HotkeyConfig> Hotkeys => UnfilteredHotkeys
?.Where(h => h != null && h.Hotkey != null && h.Options != null)
?? Enumerable.Empty<HotkeyConfig>();

public PasswordEditorConfig PasswordEditor { get; set; } = new PasswordEditorConfig();
public StyleConfig Style { get; set; } = new StyleConfig();
}
Expand Down

0 comments on commit e48a975

Please sign in to comment.