Menubar: Match for command names as well.

Enabling matching the command name of the menubar entries with the
query, which improves the flexibility of the widget. The functionality
works as follows:

You want to run GIMP, which has a name of "GNU Image Manipulation
Program". Previously by typing in gimp one would have <no matches>, but
now it will match GIMP entry.

Signed-off-by: Ignas Anikevicius (gns_ank) <anikevicius@gmail.com>
Signed-off-by: Uli Schlachter <psychon@znc.in>
This commit is contained in:
Ignas Anikevicius (gns_ank) 2012-05-04 22:51:09 +01:00 committed by Uli Schlachter
parent 6809f6afcf
commit d121d94366
1 changed files with 5 additions and 3 deletions

View File

@ -136,12 +136,14 @@ local function menulist_update(query)
end
end
-- Add the applications
-- Add the applications according to their name and cmdline
for i, v in ipairs(menu_entries) do
v.focused = false
if not current_category or v.category == current_category then
if string.match(v.name, nocase(query)) then
if string.match(v.name, "^" .. nocase(query)) then
if string.match(v.name, nocase(query))
or string.match(v.cmdline, nocase(query)) then
if string.match(v.name, "^" .. nocase(query))
or string.match(v.cmdline, "^" .. nocase(query)) then
table.insert(shownitems, v)
else
table.insert(match_inside, v)