From 6b16d19c9b70c101dd2722e2c0c1f700243416bb Mon Sep 17 00:00:00 2001 From: "Ignas Anikevicius (gns_ank)" Date: Fri, 4 May 2012 23:08:45 +0100 Subject: [PATCH] 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) Signed-off-by: Uli Schlachter --- lib/menubar/init.lua.in | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/lib/menubar/init.lua.in b/lib/menubar/init.lua.in index 4b2d36e3..d4b8e9d7 100644 --- a/lib/menubar/init.lua.in +++ b/lib/menubar/init.lua.in @@ -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