vicious/contrib
Jörg Thalheim 0156fd36f9 Merge branch 'master' of http://git.sysphere.org/vicious
Conflicts:
	contrib/README
	widgets/uptime.lua
2012-09-04 10:10:11 +02:00
..
README Merge branch 'master' of http://git.sysphere.org/vicious 2012-09-04 10:10:11 +02:00
ac.lua Merge branch 'master' of http://git.sysphere.org/vicious 2012-06-25 20:53:19 +02:00
batacpi.lua Ported vicious.contrib to lua 5.2 2012-06-18 01:27:53 +02:00
batpmu.lua Ported vicious.contrib to lua 5.2 2012-06-18 01:27:53 +02:00
batproc.lua Ported vicious.contrib to lua 5.2 2012-06-18 01:27:53 +02:00
buildbot.lua contrib: add buildbot monitoring widget 2012-09-02 12:37:18 +02:00
countfiles.lua Rename widget sumup to countfiles 2011-10-25 20:47:39 +02:00
dio.lua Ported vicious.contrib to lua 5.2 2012-06-18 01:27:53 +02:00
init.lua contrib: initialization bugfix after lua52 port 2012-06-25 00:15:51 +02:00
mpc.lua Ported vicious.contrib to lua 5.2 2012-06-18 01:27:53 +02:00
net.lua Ported vicious.contrib to lua 5.2 2012-06-18 01:27:53 +02:00
netcfg.lua Ported vicious.contrib to lua 5.2 2012-06-18 01:27:53 +02:00
ossvol.lua Ported vicious.contrib to lua 5.2 2012-06-18 01:27:53 +02:00
pop.lua Ported vicious.contrib to lua 5.2 2012-06-18 01:27:53 +02:00
pulse.lua Ported vicious.contrib to lua 5.2 2012-06-18 01:27:53 +02:00
rss.lua Ported vicious.contrib to lua 5.2 2012-06-18 01:27:53 +02:00
sensors.lua Ported vicious.contrib to lua 5.2 2012-06-18 01:27:53 +02:00
wpa.lua Merge branch 'master' of http://git.sysphere.org/vicious 2012-06-25 20:53:19 +02:00

README

Contrib
-------
Contrib widgets are extra widgets 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.


Usage
-----
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:

  vicious = require("vicious")
  vicious.contrib = require("vicious.contrib")


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.

vicious.contrib.ac
  - provide status about the power supply (AC)
  - takes the AC device as an argument, i.e "AC" or "ACAD"
  - the device is linked under /sys/class/power_supply/ and should
    have a file called "online"
  - if AC is connected, $1 returns "On", if not it returns "Off",
    if AC doesn't exist, $1 is "N/A"

vicious.contrib.batacpi
  -

vicious.contrib.batpmu
  -

vicious.contrib.batproc
  -

vicious.contrib.dio
  - provides I/O statistics for requested storage devices
  - takes the disk as an argument, i.e. "sda" (or a specific
    partition, i.e. "sda/sda2")
  - returns a table with string keys: {total_s}, {total_kb}, {total_mb},
    {read_s}, {read_kb}, {read_mb}, {write_s}, {write_kb}, {write_mb}
    and {sched}

vicious.contrib.mpc
  -

vicious.contrib.netcfg
  -

vicious.contrib.net
  -

vicious.contrib.ossvol
  -

vicious.contrib.pop
  -

vicious.contrib.pulse
    - provides volume levels of requested pulseaudio sinks and
      functions to manipulate them
    - 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 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

vicious.contrib.rss
  -

vicious.contrib.sensors
  -

vicious.contrib.wpa
  - provides information about the wifi status
  - requires 'wpa_cli' from wpa_supplicant
  - takes the interface as an argument, i.e "wlan0" or "wlan1"
  - returns a table with string keys: {ssid}, {qual}, {ip}, {bssid}

vicious.contrib.buildbot
  - provides last build status for configured buildbot builders (http://trac.buildbot.net/)
  - 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)

Usage examples
--------------
Pulse Audio widget
  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)
  ))

Buildbot widget
  local buildbotwidget = widget({ type = "textbox" })
  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)