Take the 2-minute tour ×
Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

Under awesome WM, I found Mod4 + numpad <1-9> does not work as same as Mod4 + 1-9 even though the NumLock is on. I think it's convenient to use Mod4 + numpad <1-9> to switch between tags. How to bind this?

share|improve this question
add comment

1 Answer

up vote 2 down vote accepted

I got the numpad key map by using xev. So, it may be easy to map numpad to tag switcher as the following:

-- Numpad: [0-9] = [#90, #87-#89, #83-#85, #79-#81]
local np_map = { 87, 88, 89, 83, 84, 85, 79, 80, 81 }
for i = 1, keynumber do
   globalkeys = awful.util.table.join(
      globalkeys,
      awful.key({ modkey }, "#" .. np_map[i],
        function ()
           local screen = mouse.screen
           if tags[screen][i] then
              awful.tag.viewonly(tags[screen][i])
           end
        end),
      awful.key({ modkey, "Control" }, "#" .. np_map[i],
        function ()
           local screen = mouse.screen
           if tags[screen][i] then
              awful.tag.viewtoggle(tags[screen][i])
           end
        end),
      awful.key({ modkey, "Shift" }, "#" .. np_map[i],
        function ()
           if client.focus and tags[client.focus.screen][i] then
              awful.client.movetotag(tags[client.focus.screen][i])
           end
        end),
      awful.key({ modkey, "Control", "Shift" }, "#" .. np_map[i],
        function ()
           if client.focus and tags[client.focus.screen][i] then
              awful.client.toggletag(tags[client.focus.screen][i])
           end
        end))
end
share|improve this answer
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.