From 1251c71e703e1b25e39f39984ed719234db52d21 Mon Sep 17 00:00:00 2001 From: egon984 Date: Mon, 8 Sep 2025 11:22:35 +0200 Subject: [PATCH 1/3] bugfix: new logic to handle F and backspace don't treat them as shortcuts if any text field is focused --- usr/lib/hypnotix/hypnotix.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/usr/lib/hypnotix/hypnotix.py b/usr/lib/hypnotix/hypnotix.py index 4885ac5..18cdaa6 100755 --- a/usr/lib/hypnotix/hypnotix.py +++ b/usr/lib/hypnotix/hypnotix.py @@ -1466,7 +1466,7 @@ def on_key_press_event(self, widget, event): else: self.search_button.set_active(True) elif event.keyval == Gdk.KEY_F11 or \ - (event.keyval == Gdk.KEY_f and not ctrl and type(widget.get_focus()) != gi.repository.Gtk.SearchEntry): + (event.keyval == Gdk.KEY_f and not ctrl and not isinstance(widget.get_focus(), Gtk.Entry): self.full_screen_mode() elif event.keyval == Gdk.KEY_F6: self.theather_mode() @@ -1474,7 +1474,7 @@ def on_key_press_event(self, widget, event): self.borderless_mode() elif event.keyval == Gdk.KEY_Escape: self.normal_mode() - elif event.keyval == Gdk.KEY_BackSpace and not ctrl and type(widget.get_focus()) != gi.repository.Gtk.SearchEntry: + elif event.keyval == Gdk.KEY_BackSpace and not ctrl and not isinstance(widget.get_focus(), Gtk.Entry): self.normal_mode() self.on_go_back_button() elif event.keyval == Gdk.KEY_Left: From fcb41c1cdf634a0ecfacadd5a13e6d6229dfc368 Mon Sep 17 00:00:00 2001 From: egon984 Date: Mon, 8 Sep 2025 11:26:58 +0200 Subject: [PATCH 2/3] fixed typo --- usr/lib/hypnotix/hypnotix.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/usr/lib/hypnotix/hypnotix.py b/usr/lib/hypnotix/hypnotix.py index 18cdaa6..0a89373 100755 --- a/usr/lib/hypnotix/hypnotix.py +++ b/usr/lib/hypnotix/hypnotix.py @@ -1466,7 +1466,7 @@ def on_key_press_event(self, widget, event): else: self.search_button.set_active(True) elif event.keyval == Gdk.KEY_F11 or \ - (event.keyval == Gdk.KEY_f and not ctrl and not isinstance(widget.get_focus(), Gtk.Entry): + (event.keyval == Gdk.KEY_f and not ctrl and not isinstance(widget.get_focus(), Gtk.Entry)): self.full_screen_mode() elif event.keyval == Gdk.KEY_F6: self.theather_mode() From 257ace6c76d8856c1be7f0bc23f63df5ad0ea8b0 Mon Sep 17 00:00:00 2001 From: egon984 Date: Mon, 8 Sep 2025 17:14:20 +0200 Subject: [PATCH 3/3] disable any shortcut when a text field is focused (so you can go back and forth in the field, type any letter, etc.) --- usr/lib/hypnotix/hypnotix.py | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/usr/lib/hypnotix/hypnotix.py b/usr/lib/hypnotix/hypnotix.py index 0a89373..1cf5898 100755 --- a/usr/lib/hypnotix/hypnotix.py +++ b/usr/lib/hypnotix/hypnotix.py @@ -1449,6 +1449,8 @@ def on_menu_quit(self, widget): self.application.quit() def on_key_press_event(self, widget, event): + if isinstance(widget.get_focus(), Gtk.Entry): + return False # Get any active, but not pressed modifiers, like CapsLock and NumLock persistant_modifiers = Gtk.accelerator_get_default_mod_mask() @@ -1466,7 +1468,7 @@ def on_key_press_event(self, widget, event): else: self.search_button.set_active(True) elif event.keyval == Gdk.KEY_F11 or \ - (event.keyval == Gdk.KEY_f and not ctrl and not isinstance(widget.get_focus(), Gtk.Entry)): + (event.keyval == Gdk.KEY_f and not ctrl): self.full_screen_mode() elif event.keyval == Gdk.KEY_F6: self.theather_mode() @@ -1474,7 +1476,7 @@ def on_key_press_event(self, widget, event): self.borderless_mode() elif event.keyval == Gdk.KEY_Escape: self.normal_mode() - elif event.keyval == Gdk.KEY_BackSpace and not ctrl and not isinstance(widget.get_focus(), Gtk.Entry): + elif event.keyval == Gdk.KEY_BackSpace and not ctrl: self.normal_mode() self.on_go_back_button() elif event.keyval == Gdk.KEY_Left: