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
parent 79ab69be22
commit 0424cf5e10
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

@ -833,6 +833,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/lib/linuxmint/mintInstall/icon.svg")):
if len(text) >= 3:
@ -891,6 +895,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(hash(self.searchEntry), -1)
@ -1323,8 +1328,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 + " &")