Skip to content

Commit

Permalink
Fix clear button not removing hotkey (#550)
Browse files Browse the repository at this point in the history
Previously, clicking "clear" does not change how the hotkeys are
persisted, but it does remove TriggerMode.HOTKEY from the item, which is
persisted as an empty "modes" array in the json. When autokey is
reloaded, the empty "modes" array means the hotkeys in that item are
ignored. With the aforementioned lines adding that triggermode back, the
hotkeys that are persisted are seen and taken up as hotkeys.

Priviously, saving in the gui didn't touch the hotkey if the hotkey box
wasn't enabled.
Now: saving in the gui calls item.unset_hotkey if hotkey box is
disabled.
  • Loading branch information
BlueDrink9 committed Jun 13, 2021
1 parent 48ac473 commit 9187259
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 3 deletions.
2 changes: 2 additions & 0 deletions lib/autokey/gtkui/configwindow.py
Original file line number Diff line number Diff line change
Expand Up @@ -183,6 +183,8 @@ def save(self):
self.abbrDialog.save(self.currentItem)
if self.hotkeyEnabled:
self.hotkeyDialog.save(self.currentItem)
else:
self.currentItem.unset_hotkey()
if self.filterEnabled:
self.filterDialog.save(self.currentItem)
else:
Expand Down
3 changes: 0 additions & 3 deletions lib/autokey/model/abstract_hotkey.py
Original file line number Diff line number Diff line change
Expand Up @@ -45,9 +45,6 @@ def set_hotkey(self, modifiers, key):
modifiers.sort()
self.modifiers = modifiers
self.hotKey = key
# TODO removing the next two lines fixes a bug where the "clear" button
# for hotkeys does not persist the clearance between restarts. Unsure
# whether these lines are needed, or why they fix the bug.
if key is not None and TriggerMode.HOTKEY not in self.modes:
self.modes.append(TriggerMode.HOTKEY)

Expand Down
2 changes: 2 additions & 0 deletions lib/autokey/qtui/settingswidget.py
Original file line number Diff line number Diff line change
Expand Up @@ -87,6 +87,8 @@ def save(self):
self.abbr_settings_dialog.save(self.current_item)
if self.hotkey_enabled:
self.hotkey_settings_dialog.save(self.current_item)
else:
self.currentItem.unset_hotkey()
if self.window_filter_enabled:
self.window_filter_dialog.save(self.current_item)
else:
Expand Down

0 comments on commit 9187259

Please sign in to comment.