applications plugin: Launch first application matching search on ENTER keypress.

This commit is contained in:
Benjamin L. Campbell 2014-06-27 08:38:26 -05:00 committed by Clement Lefebvre
parent 4b876e7faa
commit e12dee7b01
3 changed files with 19 additions and 0 deletions

6
install Executable file
View File

@ -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

1
test
View File

@ -1,4 +1,5 @@
#!/bin/bash #!/bin/bash
umask 002
sudo rm -rf /usr/lib/linuxmint/mintMenu sudo rm -rf /usr/lib/linuxmint/mintMenu
sudo cp -R usr / sudo cp -R usr /

View File

@ -836,6 +836,10 @@ class pluginclass( object ):
i.hide() i.hide()
else: else:
shownList.append(i) shownList.append(i)
#if this is the first matching item
#focus it
if(not showns):
i.grab_focus()
showns = True showns = True
if (not showns and os.path.exists("/usr/bin/mintinstall")): if (not showns and os.path.exists("/usr/bin/mintinstall")):
if len(text) >= 3: if len(text) >= 3:
@ -894,6 +898,7 @@ class pluginclass( object ):
# Forward all text to the search box # Forward all text to the search box
def keyPress( self, widget, event ): def keyPress( self, widget, event ):
if event.string.strip() != "" or event.keyval == Gdk.KEY_BackSpace: if event.string.strip() != "" or event.keyval == Gdk.KEY_BackSpace:
self.searchEntry.grab_focus() self.searchEntry.grab_focus()
gtk.gtk_editable_set_position.argtypes = [c_void_p, c_int] gtk.gtk_editable_set_position.argtypes = [c_void_p, c_int]
@ -1313,8 +1318,15 @@ class pluginclass( object ):
self.favoritesAdd( self.favoritesBuildLauncher( uri ) ) self.favoritesAdd( self.favoritesBuildLauncher( uri ) )
def Search( self, widget ): def Search( self, widget ):
text = self.searchEntry.get_text().strip() text = self.searchEntry.get_text().strip()
if text != "": 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() self.mintMenuWin.hide()
fullstring = self.searchtool.replace( "%s", text ) fullstring = self.searchtool.replace( "%s", text )
os.system(fullstring + " &") os.system(fullstring + " &")