kbdcfg.widget = widget({ type = "textbox",
align = "right" })
kbdcfg.widget.text = " " ..
kbdcfg.layout[kbdcfg.current] .. " "
kbdcfg.switch = function ()
kbdcfg.current = kbdcfg.current %
#(kbdcfg.layout) + 1
local t = " " ..
kbdcfg.layout[kbdcfg.current] .. " "
kbdcfg.widget.text = t
os.execute( kbdcfg.cmd .. t )
end
-- Alt + Right Shift switches the current
keyboard layout
awful.key({ "Mod1" }, "Shift_R", function ()
kbdcfg.switch() end),
-- Mouse bindings
kbdcfg.widget:buttons(awful.util.table.join(
awful.button({ }, 1, function ()
kbdcfg.switch() end)
))
-- end by me
////////////////////////////////////////////////////////
Also i add the folloiwoing section to layout:
/////////////////////////
right_layout:add(kbdcfg.widget)
//////////////////////////////////////////
Then i create a ~.xinitrc and pu into it:
//////////////////////////////////
#!/bin/sh
setxkbmap us,fa
///////////////////////////////
Also i put into the following code in rc.lua:
////////////////////////////////////////////
awful.key({ "Mod1" }, "Shift_R", function () kbdcfg.switch() end),
//////////////////////////////////////////////