Add appGenericName, appComment and appExec search

This commit is contained in:
Jesper 2024-06-12 11:51:31 +02:00
parent 3feda3af08
commit 2e0f503d08

View File

@ -781,8 +781,9 @@ class pluginclass(object):
def exact_application_search(self, search_text):
shownList = []
first_button = True
# TODO: Strip case and accents
keywords = self.strip_case_and_accents(search_text).split()
# I should probably make a function but whatever
# Add applications that match the appName
for app in self.applicationList:
for item in shownList:
if app["button"].desktopFile == item.desktopFile:
@ -794,7 +795,18 @@ class pluginclass(object):
app["button"].grab_focus()
first_button = False
shownList.append(app["button"])
print("b")
# Add applications that match appGenericName, appComment or appExec
for app in self.applicationList:
for item in shownList:
if app["button"].desktopFile == item.desktopFile:
continue
for keyword in keywords:
if keyword != "" and (self.strip_case_and_accents(app["button"].appGenericName).find(keyword) != -1 or self.strip_case_and_accents(app["button"].appComment).find(keyword) != -1 or self.strip_case_and_accents(app["button"].appExec).find(keyword) != -1):
self.applicationsBox.pack_start(app["button"], False, False, 0)
if first_button is True:
app["button"].grab_focus()
first_button = False
shownList.append(app["button"])
def Filter(self, widget, category = None):
self.filterTimer = None
@ -1735,4 +1747,4 @@ class pluginclass(object):
# print "=======>>> " + item.get_name() + " = top level"
# newApplicationsList.append({"entry": item, "category": ""})
return newApplicationsList
return newApplicationsList