GNOME Bugzilla – Bug 741804
automatically search when type
Last modified: 2015-02-16 12:58:18 UTC
Sometimes I just want to change a specific setting on the fly, it'ld be nice if I can just launch gnome-tweak-tool and start typing the setting I want to change, then move mouse and change it
Created attachment 295739 [details] [review] Patch for desired functionality I agree, when I open gnome-tweak tool I just want to start searching for a feature. This patch also fixes a bug in _on_key_press where the f key (in Ctrl-f) was being handled by multiple callbacks (since _on_key_press didn't return True that it had handled the input).
Review of attachment 295739 [details] [review]: Thanks for the patch ::: gtweak/tweakview.py @@ +198,3 @@ self._left_header.props.decoration_layout = tokens[0] + def _after_key_press(self, widget, event): return self.searchbar.handle_event() should be enough here.
Created attachment 296862 [details] [review] Updated patch The searchbar.handle_event (event) function only seems to work if the search bar is hidden or in focus. This function allows user input to be handled by the search bar when hidden, in focus or out of focus. I think the out-of-focus behaviour is good to have, that way the user can quickly continue searching as long as no other widget is capturing their keyboard input. def _after_key_press(self, widget, event): if not self.button.get_active() or not self.entry.is_focus(): if self.entry.im_context_filter_keypress(event): self.button.set_active(True) + self.entry.grab_focus () # Text in entry is selected, deselect it l = self.entry.get_text_length() self.entry.select_region(l, l) return True I did notice a couple of issues with my previous patch: above where the entry wasn't grabbing focus, and a bug I failed to squash in _on_key_press.
Review of attachment 296862 [details] [review]: Ok, let's go with this then. Only missing return False at the end of both functions i.e. on the fallback way out. Are you able to push to git.gnome.org? ::: gtweak/tweakview.py @@ +209,3 @@ + + return True + return False @@ +226,1 @@ return False
Created attachment 296902 [details] [review] Updated patch Added the fallback cases. I'm not able to push to git.gnome.org.
Review of attachment 296902 [details] [review]: looks good