Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 8 additions & 3 deletions qubes_menu/appmenu.py
Original file line number Diff line number Diff line change
Expand Up @@ -252,13 +252,18 @@
"""
Keypress handler, to allow closing the menu with an ESC key and to fix
some issues with space (as we have search by default, we should not
react to space with launching an app).
react to space with launching an app, but instead put the space
into the search bar).

Check warning on line 256 in qubes_menu/appmenu.py

View check run for this annotation

Codecov / codecov/patch

qubes_menu/appmenu.py#L255-L256

Added lines #L255 - L256 were not covered by tests
"""
if event.keyval == Gdk.KEY_Escape:
self.hide_menu()
if event.keyval == Gdk.KEY_space:
if not isinstance(self.get_active_window().get_focus(),
Gtk.SearchEntry):
current_widget = self.get_active_window().get_focus()
if isinstance(current_widget,
Gtk.SearchEntry):
p = current_widget.get_position()

Check warning on line 264 in qubes_menu/appmenu.py

View check run for this annotation

Codecov / codecov/patch

qubes_menu/appmenu.py#L261-L264

Added lines #L261 - L264 were not covered by tests
current_widget.insert_text(" ", p)
current_widget.set_position(p + 1)
return True
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I suppose current_widget is the same as the widget receiving the event? If so, this return value (whether to stop propagation) seems backwards: the search widget should continue handling the event (by inserting a space itself), while the menu items should stop handling the event. The code before this change makes more sense to me.

return False

Expand Down