Post History
Have you tried using awful's widget instead: awful.widget.keyboardlayout. It seems to be a switcher that automatically loads the available X11 settings(?). Here's a sample configuration (untested,...
#1: Initial revision
Have you tried using [awful's widget instead](https://awesomewm.org/doc/api/classes/awful.widget.keyboardlayout.html): awful.widget.keyboardlayout. It seems to be a switcher that automatically loads the available X11 settings(?).
Here's a sample configuration (untested, pruned from mine).
**NB**: I only use one layout, so I haven't tried the switching functionality.
```lua
local awful = require("awful")
local wibox = require("wibox")
local mylauncher = awful.widget.launcher({ image = beautiful.awesome_icon,
menu = mymainmenu })
local mykeyboardlayout = awful.widget.keyboardlayout()
awful.screen.connect_for_each_screen(function(s)
-- Create a promptbox for each screen
s.mypromptbox = awful.widget.prompt()
-- Create the wibox
s.mywibox = awful.wibar({ position = "top", screen = s })
-- Add widgets to the wibox
s.mywibox:setup {
layout = wibox.layout.align.horizontal,
{ -- Left widgets
layout = wibox.layout.fixed.horizontal,
mylauncher,
s.mypromptbox,
},
s.mytasklist, -- Middle widget
{ -- Right widgets
layout = wibox.layout.fixed.horizontal,
mykeyboardlayout,
wibox.widget.systray(),
},
}
end)
```
