2011-01-13 04:04:12 +01:00
|
|
|
Contrib
|
|
|
|
-------
|
2013-06-01 00:09:51 +02:00
|
|
|
Contrib libraries, or widget types, are extra snippets of code you can
|
|
|
|
use. Some are for less common hardware, and other were contributed by
|
|
|
|
Vicious users. The contrib directory also holds widget types that were
|
|
|
|
obsoleted or rewritten. Contrib widgets will not be imported by init
|
|
|
|
unless you explicitly enable it, or load them in your rc.lua.
|
2012-06-25 01:22:53 +02:00
|
|
|
|
|
|
|
|
2013-06-01 00:09:51 +02:00
|
|
|
Usage within Awesome
|
|
|
|
--------------------
|
2012-06-25 01:22:53 +02:00
|
|
|
To use contrib widgets uncomment the line that loads them in
|
|
|
|
init.lua. Or you can load them in your rc.lua after you require
|
|
|
|
Vicious:
|
|
|
|
|
2017-11-22 22:01:30 +01:00
|
|
|
```lua
|
|
|
|
vicious = require("vicious")
|
|
|
|
vicious.contrib = require("vicious.contrib")
|
|
|
|
```
|
2011-01-13 04:04:12 +01:00
|
|
|
|
|
|
|
|
|
|
|
Widget types
|
|
|
|
------------
|
|
|
|
Most widget types consist of worker functions that take the "format"
|
|
|
|
argument given to vicious.register as the first argument, "warg" as
|
|
|
|
the second, and return a table of values to insert in the format
|
|
|
|
string. But we have not insisted on this coding style in contrib. So
|
|
|
|
widgets like PulseAudio have emerged that are different. These widgets
|
|
|
|
could also depend on Lua libraries that are not distributed with the
|
|
|
|
core Lua distribution. Ease of installation and use does not
|
|
|
|
necessarily have to apply to contributed widgets.
|
|
|
|
|
2017-01-25 19:42:04 +01:00
|
|
|
**vicious.contrib.ac**
|
|
|
|
|
|
|
|
Provide status about the power supply (AC)
|
|
|
|
Supported platforms: Linux (required tools: `sysfs`)
|
|
|
|
|
|
|
|
- Arguments:
|
|
|
|
* takes the AC device as an argument, i.e "AC" or "ACAD"
|
|
|
|
* the device is linked under /sys/class/power_supply/ and should
|
2012-04-01 14:55:49 +02:00
|
|
|
have a file called "online"
|
2017-01-25 19:42:04 +01:00
|
|
|
- Returns
|
|
|
|
* if AC is connected, $1 returns "On", if not it returns "Off",
|
2012-04-01 14:55:49 +02:00
|
|
|
if AC doesn't exist, $1 is "N/A"
|
|
|
|
|
2017-01-25 19:45:19 +01:00
|
|
|
**vicious.contrib.ati**
|
|
|
|
|
|
|
|
Provides various info about ATI GPU status.
|
|
|
|
Supported platforms: Linux (required tools: `sysfs`)
|
|
|
|
|
|
|
|
- Arguments:
|
|
|
|
* takes card ID as an argument, i.e. "card0" (and where possible,
|
2013-11-02 18:07:11 +01:00
|
|
|
uses debugfs to gather data on radeon power management)
|
2017-01-25 19:45:19 +01:00
|
|
|
- Returns:
|
|
|
|
* a table with string keys: {method}, {dpm_state},
|
2013-11-02 18:07:11 +01:00
|
|
|
{dpm_perf_level}, {profile}, {engine_clock mhz}, {engine_clock khz},
|
|
|
|
{memory_clock mhz}, {memory_clock khz}, {voltage v}, {voltage mv}
|
|
|
|
|
2017-01-25 19:46:47 +01:00
|
|
|
**vicious.contrib.batpmu**
|
2011-01-13 04:04:12 +01:00
|
|
|
|
2017-01-25 19:47:47 +01:00
|
|
|
**vicious.contrib.batproc**
|
2011-01-13 04:04:12 +01:00
|
|
|
|
2017-11-22 15:22:52 +01:00
|
|
|
**vicious.contrib.btc**
|
|
|
|
|
2017-11-25 10:22:36 +01:00
|
|
|
Provides current Bitcoin price in any currency by [code](https://en.wikipedia.org/wiki/ISO_4217).
|
2017-11-25 10:14:36 +01:00
|
|
|
Requires `curl` and one of the following json libraries:
|
2017-11-25 10:22:36 +01:00
|
|
|
- [lua-cjson](https://github.com/mpx/lua-cjson/)
|
2017-11-25 10:14:36 +01:00
|
|
|
- [luajson](https://github.com/harningt/luajson/)
|
2017-11-25 10:22:36 +01:00
|
|
|
|
2017-11-25 10:14:36 +01:00
|
|
|
Supported platforms: Linux, FreeBSD
|
2017-11-22 15:22:52 +01:00
|
|
|
|
|
|
|
- Arguments:
|
|
|
|
* takes currency code, i.e. `"usd"`, `"rub"` and other. `"usd"` by
|
|
|
|
default
|
|
|
|
- Returns
|
|
|
|
* a table with string keys: {price}
|
|
|
|
|
2017-01-25 19:51:05 +01:00
|
|
|
**vicious.contrib.countfiles**
|
|
|
|
|
2017-11-22 22:01:30 +01:00
|
|
|
**vicious.widgets.cmus**
|
|
|
|
|
|
|
|
Provides cmus player information using `cmus-remote`.
|
|
|
|
Supported platforms: platform independent.
|
|
|
|
|
|
|
|
- Arguments:
|
|
|
|
* Takes a table as an argument, 1st field should be the socket including host
|
|
|
|
(or nil).
|
|
|
|
- Returns:
|
|
|
|
* Returns a table with string keys: `{status}`, `{artist}`, `{title}`,
|
|
|
|
`{duration}`, `{file}`, `{continue}`, `{shuffle}`, `{repeat}`.
|
|
|
|
|
2017-01-25 19:52:52 +01:00
|
|
|
**vicious.contrib.dio**
|
|
|
|
|
|
|
|
Provides I/O statistics for requested storage devices
|
|
|
|
|
|
|
|
- Arguments:
|
2011-03-29 02:21:53 +02:00
|
|
|
- takes the disk as an argument, i.e. "sda" (or a specific
|
|
|
|
partition, i.e. "sda/sda2")
|
2017-01-25 19:52:52 +01:00
|
|
|
- Returns:
|
|
|
|
- a table with string keys: {total_s}, {total_kb}, {total_mb},
|
2011-03-29 02:21:53 +02:00
|
|
|
{read_s}, {read_kb}, {read_mb}, {write_s}, {write_kb}, {write_mb}
|
|
|
|
and {sched}
|
|
|
|
|
2017-01-25 19:53:46 +01:00
|
|
|
**vicious.contrib.mpc**
|
2011-01-13 04:04:12 +01:00
|
|
|
|
|
|
|
vicious.contrib.netcfg
|
|
|
|
-
|
|
|
|
|
2017-01-25 19:54:04 +01:00
|
|
|
**vicious.contrib.net**
|
2011-01-13 04:04:12 +01:00
|
|
|
|
2017-01-25 20:06:45 +01:00
|
|
|
**vicious.contrib.openweather**
|
|
|
|
|
|
|
|
Provides weather information for a requested city
|
|
|
|
|
|
|
|
- Arguments
|
|
|
|
* takes OpenWeatherMap city ID as an argument, i.e. "1275339"
|
|
|
|
- Returns
|
|
|
|
* a table with string keys: {city}, {wind deg}, {wind aim},
|
2013-11-02 18:07:11 +01:00
|
|
|
{wind kmh}, {wind mps}, {sky}, {weather}, {temp c}, {humid}, {press}
|
|
|
|
|
2017-01-25 20:02:28 +01:00
|
|
|
**vicious.contrib.nvinf**
|
|
|
|
|
|
|
|
provides GPU utilization, core temperature, clock frequency information about Nvidia GPU from nvidia-settings
|
|
|
|
Supported Platforms: platform independent
|
|
|
|
|
|
|
|
- Arguments
|
|
|
|
* takes optional card ID as an argument, i.e. "1", or defaults to ID 0
|
|
|
|
- Returns
|
|
|
|
* first 4 values as usage of GPU core, memory, video engine and
|
2015-07-19 14:51:00 +02:00
|
|
|
PCIe bandwidth, 5th as temperature of requested graphics device, 6th
|
|
|
|
as frequency of GPU core, 7th as memory transfer rate
|
|
|
|
|
2017-01-25 20:05:01 +01:00
|
|
|
**vicious.contrib.nvsmi**
|
|
|
|
|
|
|
|
Provides (very basic) information about Nvidia GPU status from SMI
|
|
|
|
Supported Platforms: platform independent
|
|
|
|
|
|
|
|
- Arguments:
|
|
|
|
* takes optional card ID as an argument, i.e. "1", or defaults to ID 0
|
|
|
|
- Returns:
|
|
|
|
* returns 1st value as temperature of requested graphics device
|
2014-02-09 19:28:28 +01:00
|
|
|
|
2017-01-25 20:11:39 +01:00
|
|
|
**vicious.contrib.ossvol**
|
2011-01-13 04:04:12 +01:00
|
|
|
|
2017-01-25 20:12:10 +01:00
|
|
|
**vicious.contrib.pop**
|
2011-01-13 04:04:12 +01:00
|
|
|
|
2017-01-25 20:10:04 +01:00
|
|
|
**vicious.contrib.pulse**
|
|
|
|
|
|
|
|
Provides volume levels of requested pulseaudio sinks and functions to
|
|
|
|
manipulate them
|
|
|
|
|
|
|
|
- Arguments
|
|
|
|
* takes the name of a sink as an optional argument. a number will
|
|
|
|
be interpret as an index, if no argument is given, it will take
|
|
|
|
the first-best
|
|
|
|
* to get a list of available sinks use the command: pacmd
|
|
|
|
list-sinks | grep 'name:'
|
|
|
|
- Returns
|
|
|
|
* returns 1st value as the volume level
|
|
|
|
- vicious.contrib.pulse.add(percent, sink)
|
|
|
|
* @percent is a number, which increments or decrements the volume
|
|
|
|
level by its value in percent
|
|
|
|
* @sink optional, same usage as in vicious.contrib.pulse
|
|
|
|
* returns the exit status of pacmd
|
|
|
|
- vicious.contrib.pulse.toggle(sink)
|
|
|
|
* inverts the volume state (mute -> unmute; unmute -> mute)
|
|
|
|
* @sink optional, same usage as in vicious.contrib.pulse
|
|
|
|
* returns the exit status of pacmd
|
2011-01-13 04:04:12 +01:00
|
|
|
|
2017-01-25 20:12:43 +01:00
|
|
|
**vicious.contrib.rss**
|
2011-01-13 04:04:12 +01:00
|
|
|
|
2017-01-25 20:13:48 +01:00
|
|
|
**vicious.contrib.sensors**
|
2011-01-13 04:04:12 +01:00
|
|
|
|
2017-01-25 20:15:56 +01:00
|
|
|
**vicious.contrib.wpa**
|
|
|
|
|
|
|
|
Provides information about the wifi status
|
|
|
|
Supported Platforms: platform independent (`wpa_cli`)
|
|
|
|
|
|
|
|
- Arguments
|
2012-09-04 10:10:11 +02:00
|
|
|
- takes the interface as an argument, i.e "wlan0" or "wlan1"
|
2017-01-25 20:15:56 +01:00
|
|
|
- Returns
|
|
|
|
- a table with string keys: {ssid}, {qual}, {ip}, {bssid}
|
2012-09-04 10:10:11 +02:00
|
|
|
|
2017-01-25 19:49:53 +01:00
|
|
|
**vicious.contrib.buildbot**
|
|
|
|
|
|
|
|
Provides last build status for configured buildbot builders (http://trac.buildbot.net/)
|
|
|
|
Supported Platforms: platform independent
|
|
|
|
|
|
|
|
- Returns:
|
|
|
|
* returns build status in the format: [<builderName>.<currentBuildNumber>.<lastSuccessfulBuildNumber>]
|
|
|
|
* if <currentBuildNumber> is the same as <lastSuccessfulBuildNumber> only one number is displayed
|
|
|
|
* <buildNumber> colors: red - failed, green - successful, yellow - in progress
|
|
|
|
* it depends on lua json parser (e.g. liblua5.1-json on Ubuntu 12.04)
|
2011-01-13 04:04:12 +01:00
|
|
|
|
2013-06-01 00:09:51 +02:00
|
|
|
|
2011-01-13 04:04:12 +01:00
|
|
|
Usage examples
|
2013-06-01 00:09:51 +02:00
|
|
|
---------------------------------
|
2017-11-22 22:01:30 +01:00
|
|
|
|
|
|
|
```lua
|
2011-01-13 04:04:12 +01:00
|
|
|
Pulse Audio widget
|
2013-11-02 18:34:55 +01:00
|
|
|
vol = wibox.widget.textbox()
|
2011-01-13 04:04:12 +01:00
|
|
|
vicious.register(vol, vicious.contrib.pulse, " $1%", 2, "alsa_output.pci-0000_00_1b.0.analog-stereo")
|
|
|
|
vol:buttons(awful.util.table.join(
|
|
|
|
awful.button({ }, 1, function () awful.util.spawn("pavucontrol") end),
|
|
|
|
awful.button({ }, 4, function () vicious.contrib.pulse.add(5,"alsa_output.pci-0000_00_1b.0.analog-stereo") end),
|
|
|
|
awful.button({ }, 5, function () vicious.contrib.pulse.add(-5,"alsa_output.pci-0000_00_1b.0.analog-stereo") end)
|
|
|
|
))
|
2012-09-01 00:34:57 +02:00
|
|
|
|
|
|
|
Buildbot widget
|
2013-11-02 18:34:55 +01:00
|
|
|
buildbotwidget = wibox.widget.textbox()
|
2012-09-01 00:34:57 +02:00
|
|
|
local buildbotwidget_warg = {
|
|
|
|
{builder="coverage", url="http://buildbot.buildbot.net"},
|
|
|
|
{builder="tarball-slave", url="http://buildbot.buildbot.net"}
|
|
|
|
}
|
|
|
|
vicious.register(buildbotwidget, vicious.contrib.buildbot, "$1,", 3600, buildbotwidget_warg)
|
2017-11-22 22:01:30 +01:00
|
|
|
```
|