diff --git a/rc.lua b/rc.lua index b30cb7c..307a024 100644 --- a/rc.lua +++ b/rc.lua @@ -110,6 +110,16 @@ menubar.utils.terminal = terminal -- Set the terminal for applications that requ -- Keyboard map indicator and switcher mykeyboardlayout = awful.widget.keyboardlayout() +kbdlayout = {} +kbdlayout.cmd = "setxkbmap" +kbdlayout.layouts = { "fr", "us" } +kbdlayout.cur = 1 +kbdlayout.switch = function() + kbdlayout.cur = (kbdlayout.cur % #(kbdlayout.layouts)) + 1 + local t = kbdlayout.layouts[kbdlayout.cur] + os.execute( kbdlayout.cmd .. " " .. t ) +end + -- {{{ Wibar -- Create a textclock widget mytextclock = wibox.widget.textclock() @@ -388,7 +398,12 @@ globalkeys = gears.table.join( {description = "lua execute prompt", group = "awesome"}), -- Menubar awful.key({ modkey }, "p", function() menubar.show() end, - {description = "show the menubar", group = "launcher"}) + {description = "show the menubar", group = "launcher"}), + -- Keyboard layout switch + awful.key({ "Mod1" }, "Shift_L", function () kbdlayout.switch() end, + {description = "switch keyboard layout"}), + awful.key({ "Shift" }, "Alt_L", function () kbdlayout.switch() end, + {description = "switch keyboard layout"}) ) clientkeys = gears.table.join(