awesomerc: do not use table.insert(), define table

Signed-off-by: Julien Danjou <julien@danjou.info>
This commit is contained in:
| 2009-02-20 15:02:22 +01:00 committed by Julien Danjou
parent a89ceecb1d
commit 334adf5208
1 changed files with 80 additions and 65 deletions

View File

@ -175,16 +175,92 @@ root.buttons({
-- }}}
-- {{{ Key bindings
-- Bind keyboard digits
globalkeys =
{
key({ modkey, }, "Left", awful.tag.viewprev ),
key({ modkey, }, "Right", awful.tag.viewnext ),
key({ modkey, }, "Escape", awful.tag.history.restore),
key({ modkey, }, "j",
function ()
awful.client.focus.byidx( 1)
if client.focus then client.focus:raise() end
end),
key({ modkey, }, "k",
function ()
awful.client.focus.byidx(-1)
if client.focus then client.focus:raise() end
end),
-- Layout manipulation
key({ modkey, "Shift" }, "j", function () awful.client.swap.byidx( 1) end),
key({ modkey, "Shift" }, "k", function () awful.client.swap.byidx( -1) end),
key({ modkey, "Control" }, "j", function () awful.screen.focus( 1) end),
key({ modkey, "Control" }, "k", function () awful.screen.focus(-1) end),
key({ modkey, }, "u", awful.client.urgent.jumpto),
key({ modkey, }, "Tab",
function ()
awful.client.focus.history.previous()
if client.focus then
client.focus:raise()
end
end),
-- Standard program
key({ modkey, }, "Return", function () awful.util.spawn(terminal) end),
key({ modkey, "Control" }, "r", awesome.restart),
key({ modkey, "Shift" }, "q", awesome.quit),
key({ modkey, }, "l", function () awful.tag.incmwfact( 0.05) end),
key({ modkey, }, "h", function () awful.tag.incmwfact(-0.05) end),
key({ modkey, "Shift" }, "h", function () awful.tag.incnmaster( 1) end),
key({ modkey, "Shift" }, "l", function () awful.tag.incnmaster(-1) end),
key({ modkey, "Control" }, "h", function () awful.tag.incncol( 1) end),
key({ modkey, "Control" }, "l", function () awful.tag.incncol(-1) end),
key({ modkey, }, "space", function () awful.layout.inc(layouts, 1) end),
key({ modkey, "Shift" }, "space", function () awful.layout.inc(layouts, -1) end),
-- Prompt
key({ modkey }, "F1",
function ()
awful.prompt.run({ prompt = "Run: " },
mypromptbox[mouse.screen],
awful.util.spawn, awful.completion.bash,
awful.util.getdir("cache") .. "/history")
end),
key({ modkey }, "F4",
function ()
awful.prompt.run({ prompt = "Run Lua code: " },
mypromptbox[mouse.screen],
awful.util.eval, awful.prompt.bash,
awful.util.getdir("cache") .. "/history_eval")
end),
}
-- Client awful tagging: this is useful to tag some clients and then do stuff like move to tag on them
clientkeys =
{
key({ modkey, }, "f", function (c) c.fullscreen = not c.fullscreen end),
key({ modkey, "Shift" }, "c", function (c) c:kill() end),
key({ modkey, "Control" }, "space", awful.client.floating.toggle ),
key({ modkey, "Control" }, "Return", function (c) c:swap(awful.client.getmaster()) end),
key({ modkey, }, "o", awful.client.movetoscreen ),
key({ modkey, "Shift" }, "r", function (c) c:redraw() end),
key({ modkey }, "t", awful.client.togglemarked),
key({ modkey,}, "m",
function (c)
c.maximized_horizontal = not c.maximized_horizontal
c.maximized_vertical = not c.maximized_vertical
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
globalkeys = {}
clientkeys = {}
for i = 1, keynumber do
table.insert(globalkeys,
key({ modkey }, i,
@ -218,67 +294,6 @@ for i = 1, keynumber do
end))
end
table.insert(globalkeys, key({ modkey }, "Left", awful.tag.viewprev))
table.insert(globalkeys, key({ modkey }, "Right", awful.tag.viewnext))
table.insert(globalkeys, key({ modkey }, "Escape", awful.tag.history.restore))
table.insert(globalkeys, key({ modkey }, "j", function () awful.client.focus.byidx(1); if client.focus then client.focus:raise() end end))
table.insert(globalkeys, key({ modkey }, "k", function () awful.client.focus.byidx(-1); if client.focus then client.focus:raise() end end))
table.insert(globalkeys, key({ modkey, "Shift" }, "j", function () awful.client.swap.byidx(1) end))
table.insert(globalkeys, key({ modkey, "Shift" }, "k", function () awful.client.swap.byidx(-1) end))
table.insert(globalkeys, key({ modkey, "Control" }, "j", function () awful.screen.focus(1) end))
table.insert(globalkeys, key({ modkey, "Control" }, "k", function () awful.screen.focus(-1) end))
table.insert(globalkeys, key({ modkey }, "Tab", function () awful.client.focus.history.previous(); if client.focus then client.focus:raise() end end))
table.insert(globalkeys, key({ modkey }, "u", awful.client.urgent.jumpto))
-- Standard program
table.insert(globalkeys, key({ modkey }, "Return", function () awful.util.spawn(terminal) end))
table.insert(globalkeys, key({ modkey, "Control" }, "r", function ()
mypromptbox[mouse.screen].text =
awful.util.escape(awful.util.restart())
end))
table.insert(globalkeys, key({ modkey, "Shift" }, "q", awesome.quit))
-- Client manipulation
table.insert(clientkeys, key({ modkey }, "m", function (c) c.maximized_horizontal = not c.maximized_horizontal
c.maximized_vertical = not c.maximized_vertical end))
table.insert(clientkeys, key({ modkey }, "f", function (c) c.fullscreen = not c.fullscreen end))
table.insert(clientkeys, key({ modkey, "Shift" }, "c", function (c) c:kill() end))
table.insert(clientkeys, key({ modkey, "Control" }, "space", awful.client.floating.toggle))
table.insert(clientkeys, key({ modkey, "Control" }, "Return", function (c) c:swap(awful.client.getmaster()) end))
table.insert(clientkeys, key({ modkey }, "o", awful.client.movetoscreen))
table.insert(clientkeys, key({ modkey, "Shift" }, "r", function (c) c:redraw() end))
-- Layout manipulation
table.insert(globalkeys, key({ modkey }, "l", function () awful.tag.incmwfact(0.05) end))
table.insert(globalkeys, key({ modkey }, "h", function () awful.tag.incmwfact(-0.05) end))
table.insert(globalkeys, key({ modkey, "Shift" }, "h", function () awful.tag.incnmaster(1) end))
table.insert(globalkeys, key({ modkey, "Shift" }, "l", function () awful.tag.incnmaster(-1) end))
table.insert(globalkeys, key({ modkey, "Control" }, "h", function () awful.tag.incncol(1) end))
table.insert(globalkeys, key({ modkey, "Control" }, "l", function () awful.tag.incncol(-1) end))
table.insert(globalkeys, key({ modkey }, "space", function () awful.layout.inc(layouts, 1) end))
table.insert(globalkeys, key({ modkey, "Shift" }, "space", function () awful.layout.inc(layouts, -1) end))
-- Prompt
table.insert(globalkeys, key({ modkey }, "F1", function ()
awful.prompt.run({ prompt = "Run: " },
mypromptbox[mouse.screen],
awful.util.spawn, awful.completion.bash,
awful.util.getdir("cache") .. "/history")
end))
table.insert(globalkeys, key({ modkey }, "F4", function ()
awful.prompt.run({ prompt = "Run Lua code: " },
mypromptbox[mouse.screen],
awful.util.eval, awful.prompt.bash,
awful.util.getdir("cache") .. "/history_eval")
end))
-- Client awful tagging: this is useful to tag some clients and then do stuff like move to tag on them
table.insert(clientkeys, key({ modkey }, "t", awful.client.togglemarked))
for i = 1, keynumber do
table.insert(globalkeys, key({ modkey, "Shift" }, "F" .. i,