rc.lua: Remove the numkey loop and use the awful.key keygroup.
The result is the same. One less imperative construct in `rc.lua`.
This commit is contained in:
parent
a53ff7418e
commit
1921d54528
|
@ -378,64 +378,63 @@ clientkeys = {
|
||||||
}
|
}
|
||||||
|
|
||||||
-- @DOC_NUMBER_KEYBINDINGS@
|
-- @DOC_NUMBER_KEYBINDINGS@
|
||||||
-- Bind all key numbers to tags.
|
|
||||||
-- Be careful: we use keycodes to make it work on any keyboard layout.
|
awful.keyboard.append_global_keybindings({
|
||||||
-- This should map on the top row of your keyboard, usually 1 to 9.
|
awful.key {
|
||||||
for i = 1, 9 do
|
modifiers = { modkey },
|
||||||
-- View tag only.
|
keygroup = "numrow",
|
||||||
awful.keyboard.append_global_keybinding(awful.key(
|
description = "only view tag",
|
||||||
{ modkey }, "#" .. i + 9,
|
group = "tag",
|
||||||
function ()
|
on_press = function (index)
|
||||||
local screen = awful.screen.focused()
|
local screen = awful.screen.focused()
|
||||||
local tag = screen.tags[i]
|
local tag = screen.tags[index]
|
||||||
if tag then
|
if tag then
|
||||||
tag:view_only()
|
tag:view_only()
|
||||||
end
|
end
|
||||||
end,
|
end,
|
||||||
{description = "view tag #"..i, group = "tag"}
|
},
|
||||||
))
|
awful.key {
|
||||||
|
modifiers = { modkey, "Control" },
|
||||||
-- Toggle tag display.
|
keygroup = "numrow",
|
||||||
awful.keyboard.append_global_keybinding(awful.key(
|
description = "toggle tag",
|
||||||
{ modkey, "Control" }, "#" .. i + 9,
|
group = "tag",
|
||||||
function ()
|
on_press = function (index)
|
||||||
local screen = awful.screen.focused()
|
local screen = awful.screen.focused()
|
||||||
local tag = screen.tags[i]
|
local tag = screen.tags[index]
|
||||||
if tag then
|
if tag then
|
||||||
awful.tag.viewtoggle(tag)
|
awful.tag.viewtoggle(tag)
|
||||||
end
|
end
|
||||||
end,
|
end,
|
||||||
{description = "toggle tag #" .. i, group = "tag"}
|
},
|
||||||
))
|
awful.key {
|
||||||
|
modifiers = { modkey, "Shift" },
|
||||||
-- Move client to tag.
|
keygroup = "numrow",
|
||||||
awful.keyboard.append_global_keybinding(awful.key(
|
description = "move focused client to tag",
|
||||||
{ modkey, "Shift" }, "#" .. i + 9,
|
group = "tag",
|
||||||
function ()
|
on_press = function (index)
|
||||||
if client.focus then
|
if client.focus then
|
||||||
local tag = client.focus.screen.tags[i]
|
local tag = client.focus.screen.tags[index]
|
||||||
if tag then
|
if tag then
|
||||||
client.focus:move_to_tag(tag)
|
client.focus:move_to_tag(tag)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end,
|
end,
|
||||||
{description = "move focused client to tag #"..i, group = "tag"}
|
},
|
||||||
))
|
awful.key {
|
||||||
|
modifiers = { modkey, "Control", "Shift" },
|
||||||
-- Toggle tag on focused client.
|
keygroup = "numrow",
|
||||||
awful.keyboard.append_global_keybinding(awful.key(
|
description = "toggle focused client on tag",
|
||||||
{ modkey, "Control", "Shift" }, "#" .. i + 9,
|
group = "tag",
|
||||||
function ()
|
on_press = function (index)
|
||||||
if client.focus then
|
if client.focus then
|
||||||
local tag = client.focus.screen.tags[i]
|
local tag = client.focus.screen.tags[index]
|
||||||
if tag then
|
if tag then
|
||||||
client.focus:toggle_tag(tag)
|
client.focus:toggle_tag(tag)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end,
|
end,
|
||||||
{description = "toggle focused client on tag #" .. i, group = "tag"}
|
}
|
||||||
))
|
})
|
||||||
end
|
|
||||||
|
|
||||||
-- @DOC_CLIENT_BUTTONS@
|
-- @DOC_CLIENT_BUTTONS@
|
||||||
clientbuttons = {
|
clientbuttons = {
|
||||||
|
|
Loading…
Reference in New Issue