Menubar: 'Exec: ' item addition to the end.

This adds a 'Exec: <your-cmd-here>' item to the end of the list,
which appears only if there is at least one application entry in
the list. This is useful, when the program is not in the list of menubar
entries (e.g. it does not have a .desktop file).

When there is are no matching application entries, the 'Exec: ' item is
silently removed, as we already have the same in the prompt.

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 23:07:51 +01:00 committed by Uli Schlachter
parent 9dfe4fe84b
commit b246e87b1a
1 changed files with 4 additions and 5 deletions

View File

@ -93,9 +93,6 @@ end
-- @param o The menu item.
-- @return if the function processed the callback, new awful.prompt command, new awful.prompt prompt text.
local function perform_action(o)
if not o or o.empty then
return true
end
if o.key then
current_category = o.key
local new_prompt = shownitems[current_item].name .. ": "
@ -158,13 +155,15 @@ local function menulist_update(query)
end
if #shownitems > 0 then
-- Insert a run item value as the last choice
table.insert(shownitems, { name = "Exec: " .. query, cmdline = query, icon = nil })
if current_item > #shownitems then
current_item = #shownitems
end
shownitems[current_item].focused = true
else
table.insert(shownitems, { name = "&lt;no matches&gt;", icon = nil,
empty = true })
table.insert(shownitems, { name = "", cmdline = query, icon = nil })
end
common.list_update(common_args.w, nil, label,