From e12dee7b017b1c187296b2d8e4080c85086563d0 Mon Sep 17 00:00:00 2001 From: "Benjamin L. Campbell" Date: Fri, 27 Jun 2014 08:38:26 -0500 Subject: [PATCH] applications plugin: Launch first application matching search on ENTER keypress. --- install | 6 ++++++ test | 1 + usr/lib/linuxmint/mintMenu/plugins/applications.py | 12 ++++++++++++ 3 files changed, 19 insertions(+) create mode 100755 install diff --git a/install b/install new file mode 100755 index 0000000..3042e50 --- /dev/null +++ b/install @@ -0,0 +1,6 @@ +#!/bin/bash +umask 002 + +sudo rm -rf /usr/lib/linuxmint/mintMenu +sudo cp -R usr / +sudo glib-compile-schemas /usr/share/glib-2.0/schemas diff --git a/test b/test index 420ee58..eac076c 100755 --- a/test +++ b/test @@ -1,4 +1,5 @@ #!/bin/bash +umask 002 sudo rm -rf /usr/lib/linuxmint/mintMenu sudo cp -R usr / diff --git a/usr/lib/linuxmint/mintMenu/plugins/applications.py b/usr/lib/linuxmint/mintMenu/plugins/applications.py index 8117564..5d82990 100755 --- a/usr/lib/linuxmint/mintMenu/plugins/applications.py +++ b/usr/lib/linuxmint/mintMenu/plugins/applications.py @@ -836,6 +836,10 @@ class pluginclass( object ): i.hide() else: shownList.append(i) + #if this is the first matching item + #focus it + if(not showns): + i.grab_focus() showns = True if (not showns and os.path.exists("/usr/bin/mintinstall")): if len(text) >= 3: @@ -894,6 +898,7 @@ class pluginclass( object ): # Forward all text to the search box def keyPress( self, widget, event ): + if event.string.strip() != "" or event.keyval == Gdk.KEY_BackSpace: self.searchEntry.grab_focus() gtk.gtk_editable_set_position.argtypes = [c_void_p, c_int] @@ -1313,8 +1318,15 @@ class pluginclass( object ): self.favoritesAdd( self.favoritesBuildLauncher( uri ) ) def Search( self, widget ): + text = self.searchEntry.get_text().strip() if text != "": + for app_button in self.applicationsBox.get_children(): + if( isinstance(app_button, ApplicationLauncher) and app_button.filterText( text ) ): + app_button.execute() + self.mintMenuWin.hide() + return + self.mintMenuWin.hide() fullstring = self.searchtool.replace( "%s", text ) os.system(fullstring + " &")