Hello, I noticed today that we have a clients menu, but I also noticed that keyboard navigation doesn't apply to it. Attached is a patch against v3.4.2 that adds keygrabber support.

Only show() and toggle() accept the keygrabber boolean, but in case of the clients menu neither is called directly. Since we want the menu to always know about new clients, it is recreated. The patch adds a keygrabber param to the clients function, like it's already the case with show and toggle.

In default rc.lua clients menu is mapped to the tasklist... but I thought about using it as a simple replacement for an Alt+Tab application switcher (like other desktop environments have). In which case keyboard navigation is useful.


--
Adrian C. (anrxc) | anrxc..sysphere.org | PGP ID: D20A0618
PGP FP: 02A5 628A D8EE 2A93 996E  929F D5CB 31B7 D20A 0618
From 13de0df0be8693e41700a6e7fc9f2d60560e9815 Mon Sep 17 00:00:00 2001
From: Adrian C. (anrxc) <[email protected]>
Date: Wed, 2 Dec 2009 21:38:23 +0100
Subject: [PATCH] awful.menu: add keygrabber support to clients menu

Functions show() and toggle() accept a boolean parameter controlling
keyboard navigation. In case of the clients menu neither is called
directly, instead the clients menu is always re-created in case any
new clients appeard since the last invocation. This patch adds a
keygrabber parameter to the clients() function as well.

Signed-off-by: Adrian C. (anrxc) <[email protected]>
---
 lib/awful/menu.lua.in |    5 +++--
 1 files changed, 3 insertions(+), 2 deletions(-)

diff --git a/lib/awful/menu.lua.in b/lib/awful/menu.lua.in
index a13bd5e..68f8081 100644
--- a/lib/awful/menu.lua.in
+++ b/lib/awful/menu.lua.in
@@ -250,8 +250,9 @@ end
 
 --- Build a popup menu with running clients and shows it.
 -- @param menu Menu table, see new() function for more informations
+-- @param keygrabber A boolean enabling or not the keyboard navigation.
 -- @return The menu.
-function clients(menu)
+function clients(menu, keygrabber)
     local cls = capi.client.get()
     local cls_t = {}
     for k, c in pairs(cls) do
@@ -272,7 +273,7 @@ function clients(menu)
     menu.items = cls_t
 
     local m = new(menu)
-    m:show()
+    m:show(keygrabber)
     return m
 end
 
-- 
1.6.5.3

Reply via email to