window-managersawesome-wm

awesomewm remap tag display


I'm trying to remap my the tag display feature thats traditionally mapped to modkey, "Control", "#" .. i + 9. I have removed any other instance of {modkey, "Tab"} mappings in my rc.lua, and attempted to replace the word Control with the word Tab. However, despite the rc compiling it the command doesn't run. I have no idea why this might be hopefully one of you more experienced users will be able to see my issue.

awful.key({ modkey, "Tab" }, "#" .. i + 9,
                  function ()
                      local screen = awful.screen.focused()
                      local tag = screen.tags[i]
                      if tag then
                         awful.tag.viewtoggle(tag)
                      end
                  end,
                  {description = "toggle tag #" .. i, group = "tag}),


Solution

  • As Uli says in the comment, what can and cannot be a modified is a constraint coming from Xorg. It cannot be Tab.

    But. With awful.keygrabber, you can create a keybinding on modkey+Tab, then from that callback, start the keygrabber and intercept the number keys from there. When the keygrabber detect Tab is released, then stop it. There is multiple built-in methods and property to make this rather easy.

    See https://awesomewm.org/apidoc/core_components/awful.keygrabber.html for more details.

    Just take the Alt+Tab example (link above) and modify it to fit your use case.