DRYer
This commit is contained in:
parent
d63b852b90
commit
0d10ee1a8c
2 changed files with 5 additions and 1 deletions
|
|
@ -220,7 +220,7 @@ def set_cocoa_global_shortcuts(opts: Options) -> Dict[str, SingleKey]:
|
|||
func_map = defaultdict(list)
|
||||
for k, v in opts.keyboard_modes[''].keymap.items():
|
||||
for kd in v:
|
||||
if not kd.options.when_focus_on and not kd.options.mode and not kd.options.new_mode and not kd.is_sequence:
|
||||
if kd.is_suitable_for_global_shortcut:
|
||||
parts = tuple(kd.definition.split())
|
||||
func_map[parts].append(k)
|
||||
|
||||
|
|
|
|||
|
|
@ -1175,6 +1175,10 @@ def __init__(
|
|||
self.rest = rest
|
||||
self.options = options
|
||||
|
||||
@property
|
||||
def is_suitable_for_global_shortcut(self) -> bool:
|
||||
return not self.options.when_focus_on and not self.options.mode and not self.options.new_mode and not self.is_sequence
|
||||
|
||||
def __repr__(self) -> str:
|
||||
return self.pretty_repr('is_sequence', 'trigger', 'rest', 'options')
|
||||
|
||||
|
|
|
|||
Loading…
Reference in a new issue