common: Re-use icon_per_state
This commit is contained in:
parent
24af12e723
commit
6349721e5e
|
@ -26,6 +26,14 @@ function module.setup_icon(item,data) --TODO maybe create a proper widget
|
||||||
|
|
||||||
item.set_icon = function (_,value) icon:set_image(value) end
|
item.set_icon = function (_,value) icon:set_image(value) end
|
||||||
|
|
||||||
|
if data.icon_per_state == true then --TODO create an icon widget, see item/common.lua
|
||||||
|
item:connect_signal("state::changed",function(i,d,st)
|
||||||
|
if item._original_icon and data.icon_transformation then
|
||||||
|
wibox.widget.imagebox.set_image(icon,data.icon_transformation(item._original_icon,data,item))
|
||||||
|
end
|
||||||
|
end)
|
||||||
|
end
|
||||||
|
|
||||||
return icon
|
return icon
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
|
@ -45,14 +45,6 @@ local function create_item(item,data,args)
|
||||||
|
|
||||||
local checkbox = common.setup_checked(item,data)
|
local checkbox = common.setup_checked(item,data)
|
||||||
|
|
||||||
if data.icon_per_state == true then --TODO create an icon widget, see item/common.lua
|
|
||||||
item:connect_signal("state::changed",function(i,d,st)
|
|
||||||
if item._original_icon and data.icon_transformation then
|
|
||||||
wibox.widget.imagebox.set_image(icon,data.icon_transformation(item._original_icon,data,item))
|
|
||||||
end
|
|
||||||
end)
|
|
||||||
end
|
|
||||||
|
|
||||||
-- Define the item layout
|
-- Define the item layout
|
||||||
item.widget = wibox.widget.base.make_widget_declarative {
|
item.widget = wibox.widget.base.make_widget_declarative {
|
||||||
-- Widgets
|
-- Widgets
|
||||||
|
|
Loading…
Reference in New Issue