Sep 202017
By default, the Awesome window manager sets up 9 tags and uses a rather clever method for setting keyboard shortcuts for those tags.
And that is also one of the irritations of using Awesome because I have gotten into the habit of using more virtual screens (“tags”) than this. After a dumb way of increasing the number, I have come up with a rather improved method that can be used to replace the existing method in the Awesome rc.lua file :-
local taglist = { "1", "2", "3", "4", "5", "6", "7", "8", "9", "0", "-", "=" } -- The list of tags that I use. … awful.tag( taglist, s, awful.layout.layouts[1]) … for i = 1, #taglist do globalkeys = awful.util.table.join(globalkeys, awful.key({ modkey}, taglist[i], function () local screen = awful.screen.focused() local tag = screen.tags[i] if tag then tag:view_only() end end, {description = "view tag", group = "tag"}), awful.key({ modkey, "Control" }, taglist[i], function () local screen = awful.screen.focused() local tag = screen.tags[i] if tag then awful.tag.viewtoggle(tag) end end, {description = "toggle tag", group = "tag"}), awful.key({ modkey, "Shift" }, taglist[i], function () if client.focus then local tag = client.focus.screen.tags[i] if tag then client.focus:move_to_tag(tag) end end end, {description = "move focused client to tag", group = "tag"}), awful.key({ modkey, "Control", "Shift" }, taglist[i], function () if client.focus then local tag = client.focus.screen.tags[i] if tag then client.focus:toggle_tag(tag) end end end, {description = "toggle focused client on tag", group = "tag"}) ) end
That’s three different parts of the code to change – a list of tags to use at the top of the file, a replacement somewhere in the middle, and a large chunk replacing existing code at the end of the keyboard configuration. I don’t claim this is better than the standard way, but it is handy for me.