Merge pull request #3014 from Elv13/fix_keyboard_wdg

Fix the keyboard widget
This commit is contained in:
Emmanuel Lepage Vallée 2020-03-01 16:41:23 -05:00 committed by GitHub
commit 607badcaa7
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 21 additions and 2 deletions

View File

@ -252,6 +252,9 @@ local function update_layout(self)
update_status(self)
end
--- Select the next layout.
-- @method next_layout
--- Create a keyboard layout widget.
--
-- It shows current keyboard layout name in a textbox.
@ -260,7 +263,7 @@ end
-- @return A keyboard layout widget.
function keyboardlayout.new()
local widget = textbox()
local self = widget_base.make_widget(widget)
local self = widget_base.make_widget(widget, nil, {enable_properties=true})
self.widget = widget

View File

@ -684,8 +684,15 @@ end
-- @constructorfct wibox.widget.base.make_widget
function base.make_widget(proxy, widget_name, args)
args = args or {}
local prop_default = args.enable_properties ~= false
if awesome.api_level < 5 then
prop_default = args.enable_properties
end
local ret = object {
enable_properties = args.enable_properties,
enable_properties = prop_default,
class = args.class,
}
@ -765,6 +772,13 @@ function base.make_widget(proxy, widget_name, args)
return rawget(ret, key)
end
mt.__newindex = function(_, key, value)
if key == "buttons" then
base.widget.set_buttons(ret, value)
else
rawset(ret, key, value)
end
end
end
return setmetatable(ret, mt)

View File

@ -10,6 +10,8 @@ local say = require("say")
local assert = require("luassert")
local no_parent = base.no_parent_I_know_what_I_am_doing
_G.awesome.api_level = 9999
-- {{{ Own widget-based assertions
local function widget_fit(state, arguments)
if #arguments ~= 3 then