From 2e0f503d088f90577dfb6e888baf34620c44b7e6 Mon Sep 17 00:00:00 2001 From: Jesper Date: Wed, 12 Jun 2024 11:51:31 +0200 Subject: [PATCH] Add appGenericName, appComment and appExec search --- .../linuxmint/mintMenu/plugins/applications.py | 18 +++++++++++++++--- 1 file changed, 15 insertions(+), 3 deletions(-) diff --git a/usr/lib/linuxmint/mintMenu/plugins/applications.py b/usr/lib/linuxmint/mintMenu/plugins/applications.py index 9cc726c..4d99f5a 100755 --- a/usr/lib/linuxmint/mintMenu/plugins/applications.py +++ b/usr/lib/linuxmint/mintMenu/plugins/applications.py @@ -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 \ No newline at end of file + return newApplicationsList