Don't use obsolete table.foreach() in the default config

This replaces those repetitive calls to table.foreach() with one call to
awful.util.table.join() which gets passed all the tables returned from the
awful.key() calls.

Thanks to anrxc for testing this.

Signed-off-by: Uli Schlachter <psychon@znc.in>
This commit is contained in:
Uli Schlachter 2009-05-09 20:31:26 +02:00 committed by Julien Danjou
parent f931e0cb8e
commit 57b717aba6
1 changed files with 11 additions and 10 deletions

View File

@ -272,33 +272,34 @@ for s = 1, screen.count() do
end end
for i = 1, keynumber do for i = 1, keynumber do
table.foreach(awful.key({ modkey }, i, globalkeys = awful.util.table.join(globalkeys,
awful.key({ modkey }, i,
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), function(_, k) table.insert(globalkeys, k) end) end),
table.foreach(awful.key({ modkey, "Control" }, i, awful.key({ modkey, "Control" }, i,
function () function ()
local screen = mouse.screen local screen = mouse.screen
if tags[screen][i] then if tags[screen][i] then
tags[screen][i].selected = not tags[screen][i].selected tags[screen][i].selected = not tags[screen][i].selected
end end
end), function(_, k) table.insert(globalkeys, k) end) end),
table.foreach(awful.key({ modkey, "Shift" }, i, awful.key({ modkey, "Shift" }, i,
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), function(_, k) table.insert(globalkeys, k) end) end),
table.foreach(awful.key({ modkey, "Control", "Shift" }, i, awful.key({ modkey, "Control", "Shift" }, i,
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])
end end
end), function(_, k) table.insert(globalkeys, k) end) end),
table.foreach(awful.key({ modkey, "Shift" }, "F" .. i, awful.key({ modkey, "Shift" }, "F" .. i,
function () function ()
local screen = mouse.screen local screen = mouse.screen
if tags[screen][i] then if tags[screen][i] then
@ -306,7 +307,7 @@ for i = 1, keynumber do
awful.client.movetotag(tags[screen][i], c) awful.client.movetotag(tags[screen][i], c)
end end
end end
end), function(_, k) table.insert(globalkeys, k) end) end))
end end
-- Set keys -- Set keys