awesomerc: use keycode for tag bindings (FS#627)

Signed-off-by: Julien Danjou <julien@danjou.info>
This commit is contained in:
Julien Danjou 2009-09-18 11:41:55 +02:00
parent 36d9178917
commit 295f712552
1 changed files with 7 additions and 4 deletions

View File

@ -236,29 +236,32 @@ for s = 1, screen.count() do
keynumber = math.min(9, math.max(#tags[s], keynumber)); keynumber = math.min(9, math.max(#tags[s], keynumber));
end end
-- Bind all key numbers to tags.
-- Be careful: we use keycodes to make it works on any keyboard layout.
-- This should map on the top row of your keyboard, usually 1 to 9.
for i = 1, keynumber do for i = 1, keynumber do
globalkeys = awful.util.table.join(globalkeys, globalkeys = awful.util.table.join(globalkeys,
awful.key({ modkey }, i, awful.key({ modkey }, "#" .. i + 9,
function () function ()
local screen = mouse.screen local screen = mouse.screen
if tags[screen][i] then if tags[screen][i] then
awful.tag.viewonly(tags[screen][i]) awful.tag.viewonly(tags[screen][i])
end end
end), end),
awful.key({ modkey, "Control" }, i, awful.key({ modkey, "Control" }, "#" .. i + 9,
function () function ()
local screen = mouse.screen local screen = mouse.screen
if tags[screen][i] then if tags[screen][i] then
awful.tag.viewtoggle(tags[screen][i]) awful.tag.viewtoggle(tags[screen][i])
end end
end), end),
awful.key({ modkey, "Shift" }, i, awful.key({ modkey, "Shift" }, "#" .. i + 9,
function () function ()
if client.focus and tags[client.focus.screen][i] then if client.focus and tags[client.focus.screen][i] then
awful.client.movetotag(tags[client.focus.screen][i]) awful.client.movetotag(tags[client.focus.screen][i])
end end
end), end),
awful.key({ modkey, "Control", "Shift" }, i, awful.key({ modkey, "Control", "Shift" }, "#" .. i + 9,
function () function ()
if client.focus and tags[client.focus.screen][i] then if client.focus and tags[client.focus.screen][i] then
awful.client.toggletag(tags[client.focus.screen][i]) awful.client.toggletag(tags[client.focus.screen][i])