Actualizacion maquina principal
[dotfiles/.git] / .config / awesome / lain / wiki / Widgets.md
1 # Usage
2
3 Every lain widget is a table.
4
5 A lain widget is generated by a `function`.
6
7 The `function` signature, input and output arguments can be found in the [related wiki entry](https://github.com/lcpz/lain/wiki/Widgets#index).
8
9 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`.
10
11 Every `function` may take either a table or a list of variables as input.
12
13 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.
14
15 For instance, if `widget` is a textbox, to markup it call `widget:set_markup(...)` within `settings`.
16
17 In the scope of `settings` you can use predefined arguments, which are specified in the wiki entries.
18
19 Example of a lain widget:
20
21 ```lua
22 local cpu = lain.widget.cpu {
23     settings = function()
24         widget:set_markup("Cpu " .. cpu_now.usage)
25     end
26 }
27 -- to access the widget: cpu.widget
28 ```
29
30 If you want to see some applications, check [awesome-copycats](https://github.com/lcpz/awesome-copycats).
31
32 # Index
33
34 - [alsa](https://github.com/lcpz/lain/wiki/alsa)
35 - [alsabar](https://github.com/lcpz/lain/wiki/alsabar)
36 - [bat](https://github.com/lcpz/lain/wiki/bat)
37 - [cal](https://github.com/lcpz/lain/wiki/cal)
38 - [cpu](https://github.com/lcpz/lain/wiki/cpu)
39 - [fs](https://github.com/lcpz/lain/wiki/fs)
40 - [imap](https://github.com/lcpz/lain/wiki/imap)
41 - [mem](https://github.com/lcpz/lain/wiki/mem)
42 - [mpd](https://github.com/lcpz/lain/wiki/mpd)
43 - [net](https://github.com/lcpz/lain/wiki/net)
44 - [pulse](https://github.com/lcpz/lain/wiki/pulse)
45 - [pulsebar](https://github.com/lcpz/lain/wiki/pulsebar)
46 - [sysload](https://github.com/lcpz/lain/wiki/sysload)
47 - [temp](https://github.com/lcpz/lain/wiki/temp)
48 - [weather](https://github.com/lcpz/lain/wiki/weather)
49
50 ## Users contributed
51
52 - [moc](https://github.com/lcpz/lain/wiki/moc)
53 - [redshift](https://github.com/lcpz/lain/wiki/redshift)
54 - [task](https://github.com/lcpz/lain/wiki/task)
55 - [tp_smapi](https://github.com/lcpz/lain/wiki/tp_smapi)