Awesome: keyboard layout switch

Your keyboard bindings are not working because your keyboard no longer has those keysyms.

If you want to have, for example, Alt+F do something, then you need "F" in some key. But if you load "ru" alone, then there is no "F" at all (nor any latin letter).

I think, specially when you need to handle multiple layouts, that it is much better to let X11 (through setxkbmap) do the job for you; the way the window managers do it is much more limited as you have discovered.

You may also try, as the awfull widget seems to call setxkbmap, to change "ru" with "ru,us", eg:

kbdcfg.layout = { { "us", "" }, { "ru,us", "phonetic" } }

that way, the "us" layout will be stacked on top of the "ru" one when loaded, and the keysysms of the "us" layout, while still not directly typeable, will be seen by the X11 layer that handles the key bindings.


About AwesomeWM, from its FAQ:

You should use keycodes, instead of keynames, like this:

  1. Run xev.
  2. Press Print key.
  3. Read the output

    KeyPress event, serial 34, synthetic NO, window 0x1200002,
    root 0x291, subw 0x0, time 1510129, (471,293), root:(472,316),
    state 0x0, keycode **107** (keysym 0xff61, Print), same_screen YES,
    ...
    
  4. Create ~/screenshots, install scrot and add the following to rc.lua:

    awful.key({ }, "#107", function () awful.util.spawn("scrot -e 'mv $f ~/screenshots/ 2>/dev/null'") end),
    

Now you may test, that you can create screenshots with any keyboard layout.