awesomewm/keymaps/wmbase.lua
2010-09-15 22:42:56 +02:00

50 lines
1.9 KiB
Lua

-- Bind keyboard digits
-- 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
keybinding({ modkey }, i,
function ()
local screen = mouse.screen
if tags[screen][i] then
awful.tag.viewonly(tags[screen][i])
end
end):add()
keybinding({ modkey, "Control" }, i,
function ()
local screen = mouse.screen
if tags[screen][i] then
tags[screen][i].selected = not tags[screen][i].selected
end
end):add()
keybinding({ modkey, "Shift" }, i,
function ()
if client.focus then
if tags[client.focus.screen][i] then
awful.client.movetotag(tags[client.focus.screen][i])
end
end
end):add()
keybinding({ modkey, "Control", "Shift" }, i,
function ()
if client.focus then
if tags[client.focus.screen][i] then
awful.client.toggletag(tags[client.focus.screen][i])
end
end
end):add()
end
keybinding({ modkey }, "Left", awful.tag.viewprev):add()
keybinding({ modkey }, "Right", awful.tag.viewnext):add()
keybinding({ modkey }, "Escape", awful.tag.history.restore):add()
keybinding({ modkey, "Control" }, "r", function ()
mypromptbox[mouse.screen].text = awful.util.escape(awful.util.restart())
end):add()
keybinding({ modkey, "Shift" }, "q", awesome.quit):add()