Add kbdlayout system (Alt-Shift to switch layout)

This commit is contained in:
Arkhist 2019-07-23 14:31:57 +02:00
parent 929c94e865
commit 95e1567423
1 changed files with 16 additions and 1 deletions

17
rc.lua
View File

@ -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(