widget.keyboardlayout: add option for custom keyboard layouts (#3907)

Can be used like this:

	awful.widget.keyboardlayout({country_codes = {"raku"}})

Closes #3691
This commit is contained in:
Dmitry Matveyev 2024-08-18 15:27:34 +03:00 committed by GitHub
parent 151bb6d169
commit b9d8305639
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
1 changed files with 9 additions and 1 deletions

View File

@ -265,8 +265,16 @@ end
-- It shows current keyboard layout name in a textbox.
--
-- @constructorfct awful.widget.keyboardlayout
-- @tparam[opt] table args The argument table containing any of the arguments below.
-- @tparam[opt] table args.country_codes Array of names of custom keyboard layouts.
-- @treturn awful.widget.keyboardlayout A keyboard layout widget.
function keyboardlayout.new()
function keyboardlayout.new(args)
if args and args.country_codes then
for _, country_code in ipairs(args.country_codes) do
keyboardlayout.xkeyboard_country_code[country_code] = true
end
end
local widget = textbox()
local self = widget_base.make_widget(widget, nil, {enable_properties=true})