From b2d15898a297e1b71fc3360160f32f1d05c8edfd Mon Sep 17 00:00:00 2001 From: Vulcalien Date: Tue, 7 Dec 2021 16:09:56 +0100 Subject: [PATCH] Fix: 'None' value for keybindings breaks editor The bug: Gtk.accelerator_parse throws an error if the arg is None. This means that if one keybinding is set to None, it is impossible to set any new keybinding. --- terminatorlib/prefseditor.py | 5 ++++- terminatorlib/window.py | 2 +- 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/terminatorlib/prefseditor.py b/terminatorlib/prefseditor.py index 23325940..90e2b04c 100755 --- a/terminatorlib/prefseditor.py +++ b/terminatorlib/prefseditor.py @@ -1738,10 +1738,13 @@ class PrefsEditor: accel = Gtk.accelerator_name(key, mods) current_binding = liststore.get_value(liststore.get_iter(path), 0) + parsed_accel = Gtk.accelerator_parse(accel) duplicate_bindings = [] for conf_binding, conf_accel in self.config["keybindings"].items(): - parsed_accel = Gtk.accelerator_parse(accel) + if conf_accel is None: + continue + parsed_conf_accel = Gtk.accelerator_parse(conf_accel) if ( diff --git a/terminatorlib/window.py b/terminatorlib/window.py index 875871e0..d2d581b2 100644 --- a/terminatorlib/window.py +++ b/terminatorlib/window.py @@ -130,7 +130,7 @@ class Window(Container, Gtk.Window): # Attempt to grab a global hotkey for hiding the window. # If we fail, we'll never hide the window, iconifying instead. - if self.config['keybindings']['hide_window'] != '': + if self.config['keybindings']['hide_window'] not in ('', None): if display_manager() == 'X11': try: self.hidebound = Keybinder.bind(