2.2 KiB
Executable file
Usage
Every lain widget is a table.
A lain widget is generated by a function
.
The function
signature, input and output arguments can be found in the related wiki entry.
Every lain widget contains a wibox.widget
, which is updated by a timed function. To access the widget, use the field widget
, while to access the timed function, use the field update
. Some lain widgets may also have an icon
field, which is a wibox.widget.imagebox
, and/or a timer
field, which is the gears.timer
on update
.
Every function
may take either a table or a list of variables as input.
If the input is a table, you must define a function variable called settings
in it. There you will be able to define widget
appearance.
For instance, if widget
is a textbox, to markup it call widget:set_markup(...)
within settings
.
In the scope of settings
you can use predefined arguments, which are specified in the wiki entries.
Example of a lain widget:
local cpu = lain.widget.cpu {
settings = function()
widget:set_markup("Cpu " .. cpu_now.usage)
end
}
-- to access the widget: cpu.widget
If you want to see some applications, check awesome-copycats.