Menubar: Add navigation and execution keybindings.

This adds more navigation keybindings ('Home' and 'End'), which select
the first and the last entry from the list respectively. Also, it adds
two more keybindings:

    'Ctrl+Enter'        - Run the query (no need to press End and then
            Enter)

    'Ctrl+Alt+Enter'    - Run query in the terminal (sometimes there are
            terminal applications which one wants to run, e.g. ncmpcpp)

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:08:45 +01:00 committed by Uli Schlachter
parent 91ab7e7e71
commit 6b16d19c9b
1 changed files with 15 additions and 0 deletions

View File

@ -14,6 +14,7 @@ local awful = require("awful")
local common = require("awful.widget.common")
local theme = require("beautiful")
local menu_gen = require("menubar.menu_gen")
local menu_utils = require("menubar.utils")
local wibox = require("wibox")
-- Standard lua
@ -213,7 +214,21 @@ local function prompt_keypressed_callback(mod, key, comm)
current_item = previous_item
return true, nil, "Run app: "
end
elseif key == "Home" then
current_item = 1
return true
elseif key == "End" then
current_item = #shownitems
return true
elseif key == "Return" then
if mod.Control then
current_item = #shownitems
if mod.Mod1 then
-- add a terminal to the cmdline
shownitems[current_item].cmdline = menu_utils.terminal
.. " -e " .. shownitems[current_item].cmdline
end
end
return perform_action(shownitems[current_item])
end
return false