awful.menu: always enable keyboard navigation
I don't see why people would not want keyboard-enabled-menu by default. Without it, you can't even use 'Escape' to quit the menu or press 'Enter' to execute an entry. But instead of just enabling keyboard support by default, we remove the option of disabling keyboard support altogether, which also simplifies the implementation a bit. Signed-off-by: Anurag Priyam <anurag08priyam@gmail.com> Signed-off-by: Uli Schlachter <psychon@znc.in>
This commit is contained in:
parent
69a96fc505
commit
1e4bf83d3b
|
@ -210,7 +210,7 @@ globalkeys = awful.util.table.join(
|
||||||
awful.client.focus.byidx(-1)
|
awful.client.focus.byidx(-1)
|
||||||
if client.focus then client.focus:raise() end
|
if client.focus then client.focus:raise() end
|
||||||
end),
|
end),
|
||||||
awful.key({ modkey, }, "w", function () mymainmenu:show({keygrabber=true}) end),
|
awful.key({ modkey, }, "w", function () mymainmenu:show() end),
|
||||||
|
|
||||||
-- Layout manipulation
|
-- Layout manipulation
|
||||||
awful.key({ modkey, "Shift" }, "j", function () awful.client.swap.byidx( 1) end),
|
awful.key({ modkey, "Shift" }, "j", function () awful.client.swap.byidx( 1) end),
|
||||||
|
|
|
@ -316,26 +316,16 @@ end
|
||||||
|
|
||||||
--- Show a menu.
|
--- Show a menu.
|
||||||
-- @param menu The menu to show.
|
-- @param menu The menu to show.
|
||||||
-- @param args.keygrabber A boolean enabling or not the keyboard navigation.
|
|
||||||
-- @param args.coords Menu position defaulting to mouse.coords()
|
-- @param args.coords Menu position defaulting to mouse.coords()
|
||||||
function show(menu, args)
|
function show(menu, args)
|
||||||
args = args or {}
|
args = args or {}
|
||||||
local coords = args.coords or nil
|
local coords = args.coords or nil
|
||||||
local screen_index = capi.mouse.screen
|
local screen_index = capi.mouse.screen
|
||||||
local keygrabber = args.keygrabber or false
|
|
||||||
|
|
||||||
if not set_size(menu) then return end
|
if not set_size(menu) then return end
|
||||||
set_coords(menu, screen_index, coords)
|
set_coords(menu, screen_index, coords)
|
||||||
|
|
||||||
if menu.parent then
|
if not cur_menu then
|
||||||
menu.keygrabber = menu.parent.keygrabber
|
|
||||||
elseif keygrabber ~= nil then
|
|
||||||
menu.keygrabber = keygrabber
|
|
||||||
else
|
|
||||||
menu.keygrabber = false
|
|
||||||
end
|
|
||||||
|
|
||||||
if not cur_menu and menu.keygrabber then
|
|
||||||
capi.keygrabber.run(grabber)
|
capi.keygrabber.run(grabber)
|
||||||
end
|
end
|
||||||
cur_menu = menu
|
cur_menu = menu
|
||||||
|
@ -358,7 +348,7 @@ function hide(menu)
|
||||||
if cur_menu == menu then
|
if cur_menu == menu then
|
||||||
cur_menu = cur_menu.parent
|
cur_menu = cur_menu.parent
|
||||||
end
|
end
|
||||||
if not cur_menu and menu.keygrabber then
|
if not cur_menu then
|
||||||
capi.keygrabber.stop()
|
capi.keygrabber.stop()
|
||||||
end
|
end
|
||||||
menu.wibox.visible = false
|
menu.wibox.visible = false
|
||||||
|
@ -366,7 +356,6 @@ end
|
||||||
|
|
||||||
--- Toggle menu visibility.
|
--- Toggle menu visibility.
|
||||||
-- @param menu The menu to show if it's hidden, or to hide if it's shown.
|
-- @param menu The menu to show if it's hidden, or to hide if it's shown.
|
||||||
-- @param args.keygrabber A boolean enabling or not the keyboard navigation.
|
|
||||||
-- @param args.coords Menu position {x,y}
|
-- @param args.coords Menu position {x,y}
|
||||||
function toggle(menu, args)
|
function toggle(menu, args)
|
||||||
if menu.wibox.visible then
|
if menu.wibox.visible then
|
||||||
|
@ -380,9 +369,7 @@ end
|
||||||
-- @param menu The mnenu to update.
|
-- @param menu The mnenu to update.
|
||||||
function update(menu)
|
function update(menu)
|
||||||
if menu.wibox.visible then
|
if menu.wibox.visible then
|
||||||
menu:show({
|
menu:show({ coords = { x = menu.x, y = menu.y } })
|
||||||
keygrabber = menu.keygrabber,
|
|
||||||
coords = { x = menu.x, y = menu.y } })
|
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
@ -488,7 +475,6 @@ end
|
||||||
|
|
||||||
--- Build a popup menu with running clients and shows it.
|
--- Build a popup menu with running clients and shows it.
|
||||||
-- @param menu Menu table, see new() function for more informations
|
-- @param menu Menu table, see new() function for more informations
|
||||||
-- @param args.keygrabber A boolean enabling or not the keyboard navigation.
|
|
||||||
-- @return The menu.
|
-- @return The menu.
|
||||||
function clients(menu, args) -- FIXME crude api
|
function clients(menu, args) -- FIXME crude api
|
||||||
menu = menu or {}
|
menu = menu or {}
|
||||||
|
@ -644,9 +630,7 @@ end
|
||||||
-- } <br/>
|
-- } <br/>
|
||||||
-- end <br/>
|
-- end <br/>
|
||||||
-- end <br/>
|
-- end <br/>
|
||||||
-- m = awful.menu(terms) <br/>
|
-- awful.menu(terms):show() <br/>
|
||||||
-- m:show({keygrabber=true}) <br/>
|
|
||||||
-- return m <br/>
|
|
||||||
-- end <br/>
|
-- end <br/>
|
||||||
--</code></p>
|
--</code></p>
|
||||||
function new(args, parent)
|
function new(args, parent)
|
||||||
|
|
Loading…
Reference in New Issue