From: Fabienne Ducroquet <fabi...@gmail.com>
Date: Mon, 17 Aug 2009 22:21:25 +0200


Signed-off-by: Fabienne Ducroquet <fabi...@gmail.com>
---

On Mon, 17 Aug 2009 11:42:09 +0200, Tanguy Ortolo 
<tanguy+awes...@ortolo.eu> wrote:
>As maybe every french awesome user, I had to redefine the upper row key
>bindings, as the french keymap does not have digits directly on it.

>I found a way to use keycodes instead of keysyms to define these
>bindings.  As keycodes are keymap-independant, this setting should be
>convenient to any keymap, and avoid the need of redefining bindings. So
>here is the configuration for awesome 3.2.1, if it can be useful.

I have been using something similar (and thinking that I should take the 
time to send a patch...) in my config file for quite a long time, but 
instead of using a table of keycodes I use a table of keysyms (and I put 
it with the definition of the tags rather than in the middle of the 
keybindings to make it more visible). So as apparently Julien doesn't 
like keycodes (I don't either), here is a patch that renders the 
configuration change needed for people with an AZERTY or Czech layout 
(the only 3 (yes, there are 2 AZERTY layouts) keyboard layouts that use 
latin characters and don't have the numbers in direct access, if 
I believe Wikipedia) obvious, even if they will still get a non-working 
default configuration.

Regarding http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=508417, the 
reason to do something for the configuration of the keys associated with 
tags but not for other keys such as hjkl is that the keybindings for the 
operations on tags are defined in a loop, so with the current 
configuration, if you want to use &é"'(-è_ç or e.g. 321qazxcv for your 
tags but don't know that you could define a table to do so in a simple 
way, you have to unroll the loop (or spend time looking for another 
solution), which is not very convenient... All the other keybindings are 
defined individually, so if you want to use ctsr instead of hjkl you can 
simply search and replace.

Cheers,
Fabienne

(patch against bbb61d027a630aeda05463c00fb64da8e37bbd74, aka master~2 
ATM)

 awesomerc.lua.in |   28 +++++++++++++++++-----------
 1 files changed, 17 insertions(+), 11 deletions(-)

diff --git a/awesomerc.lua.in b/awesomerc.lua.in
index 9a35114..1dff0ed 100644
--- a/awesomerc.lua.in
+++ b/awesomerc.lua.in
@@ -88,6 +88,18 @@ for s = 1, screen.count() do
     -- I'm sure you want to see at least one tag.
     tags[s][1].selected = true
 end
+
+-- Table of keys to use for the tags
+-- You can use keysyms (as done below) or keycodes (e.g. "#10" for 1 on 
+-- a QWERTY US layout) or unicode values (e.g. "U0031" for 1).
+-- Default, for most layouts
+tagkeys = { "1", "2", "3", "4", "5", "6", "7", "8", "9" }
+-- AZERTY Belgian
+--tagkeys = { "ampersand", "eacute", "quotedbl", "apostrophe", "parenleft", 
"section", "egrave", "exclam", "ccedilla" }
+-- AZERTY French
+--tagkeys = { "ampersand", "eacute", "quotedbl", "apostrophe", "parenleft", 
"minus", "egrave", "underscore", "ccedilla" }
+-- Czech
+--tagkeys = { "plus", "ecaron", "scaron", "ccaron", "rcaron", "zcaron", 
"yacute", "aacute", "iacute" }
 -- }}}
 
 -- {{{ Wibox
@@ -271,35 +283,29 @@ clientkeys = awful.util.table.join(
         end)
 )
 
--- Compute the maximum number of digit we need, limited to 9
-keynumber = 0
-for s = 1, screen.count() do
-   keynumber = math.min(9, math.max(#tags[s], keynumber));
-end
-
-for i = 1, keynumber do
+for i, k in ipairs(tagkeys) do
     globalkeys = awful.util.table.join(globalkeys,
-        awful.key({ modkey }, i,
+        awful.key({ modkey }, k,
                   function ()
                         local screen = mouse.screen
                         if tags[screen][i] then
                             awful.tag.viewonly(tags[screen][i])
                         end
                   end),
-        awful.key({ modkey, "Control" }, i,
+        awful.key({ modkey, "Control" }, k,
                   function ()
                       local screen = mouse.screen
                       if tags[screen][i] then
                           tags[screen][i].selected = not 
tags[screen][i].selected
                       end
                   end),
-        awful.key({ modkey, "Shift" }, i,
+        awful.key({ modkey, "Shift" }, k,
                   function ()
                       if client.focus and tags[client.focus.screen][i] then
                           awful.client.movetotag(tags[client.focus.screen][i])
                       end
                   end),
-        awful.key({ modkey, "Control", "Shift" }, i,
+        awful.key({ modkey, "Control", "Shift" }, k,
                   function ()
                       if client.focus and tags[client.focus.screen][i] then
                           awful.client.toggletag(tags[client.focus.screen][i])
-- 
1.6.3.3


-- 
To unsubscribe, send mail to awesome-devel-unsubscr...@naquadah.org.

Reply via email to