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
umask 002
sudo rm -rf /usr/lib/linuxmint/mintMenu
sudo cp -R usr /

View File

@ -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 + " &")