2009-09-07 23:02:56 +02:00
|
|
|
vicious
|
|
|
|
=======
|
|
|
|
vicious is a modular widget library for "awesome" window manager,
|
2009-07-30 04:44:22 +02:00
|
|
|
derived from the "Wicked" widget library. It has some of the old
|
|
|
|
Wicked widget types, a few of them rewritten, and a good number of new
|
2009-09-14 20:55:53 +02:00
|
|
|
widgets.
|
2009-07-30 04:44:22 +02:00
|
|
|
|
|
|
|
|
|
|
|
Usage
|
|
|
|
-----
|
2009-09-14 20:55:53 +02:00
|
|
|
To use vicious, copy it to the ~/.config/awesome directory, edit
|
|
|
|
init.lua and comment out all the widgets you don't need, from the
|
2009-07-30 17:15:21 +02:00
|
|
|
"Configure widgets" list. Then add:
|
2009-07-30 04:44:22 +02:00
|
|
|
|
|
|
|
require("vicious")
|
|
|
|
|
2009-09-14 20:55:53 +02:00
|
|
|
...to the top of your rc.lua.
|
|
|
|
|
|
|
|
Once you create a widget (as a: textbox, graph or a progressbar) call
|
|
|
|
vicious.register() to register it with vicious:
|
2009-07-30 04:44:22 +02:00
|
|
|
|
2009-08-27 03:37:34 +02:00
|
|
|
vicious.register(widget, type, format, interval, warg)
|
2009-07-30 04:44:22 +02:00
|
|
|
|
2009-08-27 03:37:34 +02:00
|
|
|
widget - widget created with widget() or awful.widget (in case of a
|
|
|
|
graph or a progressbar)
|
2009-09-14 20:55:53 +02:00
|
|
|
type - one of the available widget types (a list is below)
|
2009-07-30 04:44:22 +02:00
|
|
|
format - a string argument or a function
|
2009-09-07 23:02:56 +02:00
|
|
|
+ string
|
2009-08-27 03:37:34 +02:00
|
|
|
- $1, $2, $3... will be replaced by their respective value
|
|
|
|
returned from the widget type
|
|
|
|
- some widget types return tables with custom keys, in that
|
|
|
|
case use: ${key}
|
2009-09-07 23:02:56 +02:00
|
|
|
+ function
|
2009-08-27 03:37:34 +02:00
|
|
|
- function(widget, args) can be used to manipulate data
|
|
|
|
returned by the widget type, more below
|
2009-07-30 04:44:22 +02:00
|
|
|
interval - number of seconds between updates of the widget
|
2009-09-07 23:02:56 +02:00
|
|
|
warg - some widgets require an argument to be passed, i.e. the
|
2009-07-30 04:44:22 +02:00
|
|
|
battery ID
|
|
|
|
|
|
|
|
|
|
|
|
Other Functions
|
|
|
|
---------------
|
|
|
|
Unregister
|
|
|
|
vicious.unregister(widget, keep)
|
|
|
|
|
|
|
|
keep - if true the widget will be suspended, waiting to be activated
|
|
|
|
|
|
|
|
Suspend - suspend all widgets, used when running on battery power
|
|
|
|
vicious.suspend()
|
|
|
|
|
2009-08-10 02:33:16 +02:00
|
|
|
- if you want it to happen automatically, see the example script for
|
|
|
|
the laptop-mode-tools start-stop programs module:
|
2009-09-07 23:02:56 +02:00
|
|
|
|
|
|
|
http://sysphere.org/~anrxc/local/sources/lmt-vicious.sh
|
2009-08-10 02:33:16 +02:00
|
|
|
|
2009-07-30 04:44:22 +02:00
|
|
|
Activate - restart all suspended, or unregistered but kept, widgets
|
|
|
|
vicious.activate(widget)
|
|
|
|
|
|
|
|
widget - if provided, only that widget will be activated
|
|
|
|
|
|
|
|
Regregister
|
|
|
|
vicious.regregister(reg)
|
|
|
|
|
|
|
|
- vicious.register() and vicious.unregister() both return a reg object, this
|
|
|
|
contains information about the widget and the updates that should be sent to
|
|
|
|
it, you can pass this reg object into regregister after unregistering it, and
|
|
|
|
it will be reregistered (or activated if it was only suspended).
|
|
|
|
|
|
|
|
Caching
|
|
|
|
vicious.enable_caching(type)
|
|
|
|
|
|
|
|
- by default caching is enabled for all widget types, with caching
|
|
|
|
you can have multiple widgets using the same (widget type)function
|
|
|
|
and it gets executed only once
|
|
|
|
|
|
|
|
|
|
|
|
Widget types
|
|
|
|
------------
|
|
|
|
Widget types consist of worker functions that take the "format"
|
2009-08-05 21:50:41 +02:00
|
|
|
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.
|
2009-07-30 04:44:22 +02:00
|
|
|
|
|
|
|
vicious.widgets.cpu
|
|
|
|
- provides CPU usage for all available CPUs/cores
|
|
|
|
|
2009-08-06 18:21:13 +02:00
|
|
|
vicious.widgets.cpuinf
|
|
|
|
- provides speed and cache information for all available CPUs/cores
|
|
|
|
|
2009-08-03 04:40:55 +02:00
|
|
|
vicious.widgets.cpufreq
|
|
|
|
- provides freq, voltage and governor info for a requested CPU
|
|
|
|
- takes the CPU ID as an argument, i.e. "cpu0"
|
|
|
|
|
2009-07-30 04:44:22 +02:00
|
|
|
vicious.widgets.thermal
|
|
|
|
- provides temperature levels of ACPI thermal zones
|
|
|
|
- takes the thermal zone as an argument, i.e. "TZS0"
|
|
|
|
|
|
|
|
vicious.widgets.load
|
|
|
|
- provides system load averages for the past 1, 5, and 15 minutes
|
|
|
|
|
|
|
|
vicious.widgets.uptime
|
|
|
|
- provides system uptime information
|
|
|
|
|
|
|
|
vicious.widgets.bat
|
|
|
|
- provides state, charge, and remaining time for a requested battery
|
|
|
|
- takes battery ID as an argument, i.e. "BAT0"
|
|
|
|
|
|
|
|
vicious.widgets.batat
|
|
|
|
- provides state, charge, and remaining time for all batteries using
|
|
|
|
acpitool
|
|
|
|
|
|
|
|
vicious.widgets.mem
|
|
|
|
- provides RAM and Swap usage statistics
|
|
|
|
|
|
|
|
vicious.widgets.fs
|
2009-08-06 21:59:12 +02:00
|
|
|
- provides file system disk space usage
|
2009-09-14 20:55:53 +02:00
|
|
|
- takes an (optional) argument which, if true, includes remote file
|
|
|
|
systems, only local file systems are included by default
|
2009-07-30 04:44:22 +02:00
|
|
|
|
|
|
|
vicious.widgets.dio
|
|
|
|
- provides I/O statistics for requested storage devices
|
|
|
|
- takes the disk as an argument, i.e. "/dev/hda"
|
|
|
|
|
2009-08-06 02:41:46 +02:00
|
|
|
vicious.widgets.hddtemp
|
|
|
|
- provides hard drive temperatures using the hddtemp daemon
|
|
|
|
- takes the hddtemp listening port as an argument, or fallbacks to
|
|
|
|
default port 7634
|
|
|
|
|
2009-07-30 04:44:22 +02:00
|
|
|
vicious.widgets.net
|
|
|
|
- provides usage statistics for all network interfaces
|
|
|
|
|
|
|
|
vicious.widgets.wifi
|
|
|
|
- provides wireless information for a requested interface
|
|
|
|
- takes the network interface as an argument, i.e. "wlan0"
|
|
|
|
|
|
|
|
vicious.widgets.mbox
|
|
|
|
- provides the subject of last e-mail in a mbox file
|
|
|
|
- takes the full path to the mbox as an argument
|
|
|
|
|
2009-07-31 07:49:28 +02:00
|
|
|
vicious.widgets.mboxc
|
|
|
|
- provides the count of total, old and new messages in a mbox
|
|
|
|
- takes the full path to the mbox as an argument
|
|
|
|
|
2009-07-30 04:44:22 +02:00
|
|
|
vicious.widgets.mdir
|
|
|
|
- provides a number of new and unread messages in a Maildir
|
|
|
|
structure
|
|
|
|
- takes the full path to the Maildir structure as an argument
|
|
|
|
|
2009-09-08 22:46:59 +02:00
|
|
|
vicious.widgets.gmail
|
|
|
|
- provides count of new and subject of last e-mail in a Gmail inbox
|
|
|
|
- takes a table with Gmail login information as an argument
|
|
|
|
|
2009-07-30 04:44:22 +02:00
|
|
|
vicious.widgets.entropy
|
|
|
|
- provides available system entropy
|
2009-08-06 22:03:21 +02:00
|
|
|
- takes the poolsize as an argument, or fallbacks to Linux 2.6
|
|
|
|
default entropy pool of 4096-bits
|
2009-07-30 04:44:22 +02:00
|
|
|
|
|
|
|
vicious.widgets.org
|
|
|
|
- provides agenda statistics for Emacs org-mode
|
|
|
|
- takes a table with full paths to agenda files, that will be
|
2009-09-08 22:46:59 +02:00
|
|
|
parsed, as an argument
|
2009-07-30 04:44:22 +02:00
|
|
|
|
|
|
|
vicious.widgets.pacman
|
|
|
|
- provides number of pending updates on Arch Linux
|
|
|
|
|
|
|
|
vicious.widgets.mpd
|
|
|
|
- provides the currently playing song in MPD
|
|
|
|
|
|
|
|
vicious.widgets.volume
|
|
|
|
- provides volume levels of requested ALSA mixers
|
|
|
|
- takes the ALSA channel as an argument, i.e. "Master"
|
|
|
|
|
|
|
|
vicious.widgets.weather
|
|
|
|
- provides weather information for a requested station
|
|
|
|
- takes the weather station ID as an argument, i.e. "LDRI"
|
|
|
|
|
|
|
|
vicious.widgets.date
|
|
|
|
- provides access to os.date, with optional custom formatting;
|
|
|
|
provided as the format string
|
|
|
|
|
|
|
|
|
|
|
|
Custom widget types
|
|
|
|
-------------------
|
2009-09-14 20:55:53 +02:00
|
|
|
Use any of the existing widgets as a starting point for your
|
|
|
|
own. Write a quick worker function that does the work and plug it
|
2009-09-07 23:02:56 +02:00
|
|
|
in. How data will be formatted, will it be red or blue, should be
|
2009-09-14 20:55:53 +02:00
|
|
|
defined in rc.lua (or somewhere else, outside the actual widget).
|
2009-07-30 04:44:22 +02:00
|
|
|
|
|
|
|
|
|
|
|
Format functions
|
|
|
|
----------------
|
|
|
|
You can use a function instead of a string as the format parameter, so
|
|
|
|
you are able to check the value returned by the widget type and change
|
2009-09-08 22:46:59 +02:00
|
|
|
it. You can change the color of the battery widget when it goes below
|
|
|
|
a certain point, or hide widgets when they return a certain value,
|
|
|
|
or...
|
|
|
|
|
|
|
|
- do not confuse this with just coloring the widget, in those cases
|
|
|
|
standard markup can be inserted into the format string
|
2009-07-30 04:44:22 +02:00
|
|
|
|
|
|
|
The format function will get the widget as its first argument, and a
|
|
|
|
table with the values otherwise inserted into the format string as its
|
|
|
|
second argument, and should return the text to be used for the widget.
|
|
|
|
|
|
|
|
Example widget
|
2009-08-06 21:59:12 +02:00
|
|
|
mpdwidget = widget({ type = 'textbox', name = 'mpdwidget' })
|
2009-07-30 04:44:22 +02:00
|
|
|
vicious.register(mpdwidget,vicious.widgets.mpd,
|
|
|
|
function (widget, args)
|
2009-09-18 00:13:20 +02:00
|
|
|
if args[1] == "Stopped" then return ''
|
|
|
|
else return '<span color="white">MPD:</span> '..args[1]
|
2009-07-30 04:44:22 +02:00
|
|
|
end
|
2009-09-18 00:13:20 +02:00
|
|
|
end)
|
2009-07-30 04:44:22 +02:00
|
|
|
|
2009-09-18 00:13:20 +02:00
|
|
|
- hides the mpd widget when there is no song playing, executed every
|
|
|
|
second (the default interval)
|
2009-07-30 04:44:22 +02:00
|
|
|
|
|
|
|
|
|
|
|
Usage examples
|
|
|
|
--------------
|
|
|
|
Remember, besides creating and registering widgets you have to add them
|
2009-09-07 23:02:56 +02:00
|
|
|
to a wibox in order to display them.
|
2009-07-30 04:44:22 +02:00
|
|
|
|
|
|
|
MPD widget
|
2009-08-05 22:33:44 +02:00
|
|
|
mpdwidget = widget({ type = 'textbox', name = 'mpdwidget' })
|
2009-09-18 00:13:20 +02:00
|
|
|
vicious.register(mpdwidget, vicious.widgets.mpd, '$1', 15)
|
2009-07-30 04:44:22 +02:00
|
|
|
|
2009-09-18 00:13:20 +02:00
|
|
|
- executed every 15 seconds, takes no arguments
|
2009-07-30 04:44:22 +02:00
|
|
|
|
|
|
|
Memory widget
|
2009-08-05 22:33:44 +02:00
|
|
|
memwidget = widget({ type = 'textbox', name = 'memwidget' })
|
2009-08-06 21:59:12 +02:00
|
|
|
vicious.register(memwidget, vicious.widgets.mem, '$1 ($2MB/$3MB)', 10)
|
2009-07-30 04:44:22 +02:00
|
|
|
|
2009-08-06 21:59:12 +02:00
|
|
|
- executed every 10 seconds, appends "MB" to 2nd and 3rd argument
|
2009-07-30 04:44:22 +02:00
|
|
|
|
|
|
|
File system widget
|
2009-08-27 03:37:34 +02:00
|
|
|
fswidget = awful.widget.progressbar({ layout = awful.widget.layout.horizontal.rightleft })
|
|
|
|
-- after setting progressbar properties, you can register with:
|
2009-09-14 20:55:53 +02:00
|
|
|
vicious.register(fswidget, vicious.widgets.fs, '${/home usep}', 120, true)
|
2009-07-30 04:44:22 +02:00
|
|
|
|
2009-08-06 21:59:12 +02:00
|
|
|
- executed every 120 seconds, requests the value of the ${/home usep}
|
2009-09-14 20:55:53 +02:00
|
|
|
key (/home usage in percent), enables support for remote file systems
|
2009-07-30 04:44:22 +02:00
|
|
|
|
2009-08-06 02:41:46 +02:00
|
|
|
HDD temperature widget
|
|
|
|
hddtempwidget = widget({ type = 'textbox', name = 'hddtempwidget' })
|
|
|
|
vicious.register(hddtempwidget, vicious.widgets.hddtemp, '${/dev/sda}°C', 240)
|
|
|
|
|
|
|
|
- executed every 240 seconds, requests the temperature level of the
|
2009-08-06 21:59:12 +02:00
|
|
|
${/dev/sda} key/disk and appends "°C" to the returned value, does
|
2009-08-06 02:41:46 +02:00
|
|
|
not provide the port argument so it fallbacks to default
|
|
|
|
|
2009-07-30 04:44:22 +02:00
|
|
|
Battery widget
|
2009-08-27 03:37:34 +02:00
|
|
|
batwidget = awful.widget.progressbar({ layout = awful.widget.layout.horizontal.rightleft })
|
|
|
|
-- after setting progressbar properties, you can register with:
|
|
|
|
vicious.register(batwidget, vicious.widgets.bat, '$2', 60, 'BAT0')
|
2009-07-30 04:44:22 +02:00
|
|
|
|
2009-08-27 03:37:34 +02:00
|
|
|
- executed every 60 seconds, provides "BAT0" battery ID as an
|
|
|
|
argument
|
|
|
|
|
|
|
|
CPU usage widget
|
|
|
|
cpuwidget = awful.widget.graph({ layout = awful.widget.layout.horizontal.rightleft })
|
|
|
|
-- after setting graph properties, you can register with:
|
|
|
|
vicious.register(cpuwidget, vicious.widgets.cpu, '$1', 2)
|
|
|
|
|
2009-09-13 00:46:22 +02:00
|
|
|
- executed every 2 seconds, feeds the graph with total usage
|
|
|
|
percentage of all CPUs/cores
|
2009-07-30 04:44:22 +02:00
|
|
|
|
|
|
|
Mbox widget
|
2009-08-05 22:33:44 +02:00
|
|
|
mboxwidget = widget({ type = 'textbox', name = 'mboxwidget' })
|
2009-08-27 03:37:34 +02:00
|
|
|
vicious.register(mboxwidget, vicious.widgets.mbox, '$1', 240, '/home/user/mail/Inbox')
|
2009-07-30 04:44:22 +02:00
|
|
|
|
|
|
|
- executed every 240 seconds, provides full path to the mbox as an
|
|
|
|
argument
|
|
|
|
|
2009-09-08 22:46:59 +02:00
|
|
|
Gmail widget
|
|
|
|
gmailwidget = widget({ type = 'textbox', name = 'gmailwidget' })
|
|
|
|
vicious.register(gmailwidget, vicious.widgets.gmail, 'Mail: ${count}', 600, {'user', 'pass'})
|
|
|
|
|
|
|
|
- executed every 10 minutes, provides a table with login information
|
|
|
|
as an argument, prepends "Mail: " to the returned value
|
|
|
|
|
2009-07-30 04:44:22 +02:00
|
|
|
|
2009-09-07 23:02:56 +02:00
|
|
|
All other widgets are used in the same manner, read each widget you
|
|
|
|
are interested in to see what data it returns. You can also use
|
|
|
|
authors rc.lua as a reference to see how it all fits into the big
|
|
|
|
picture:
|
2009-07-30 04:44:22 +02:00
|
|
|
|
2009-09-06 00:25:22 +02:00
|
|
|
http://git.sysphere.org/awesome-configs/
|
2009-07-30 04:44:22 +02:00
|
|
|
|
|
|
|
|
|
|
|
Other
|
|
|
|
-----
|
|
|
|
You should read "awesome" manual pages:
|
|
|
|
|
2009-09-07 23:02:56 +02:00
|
|
|
awesome(1) awesomerc(5)
|
2009-07-30 04:44:22 +02:00
|
|
|
|
|
|
|
|
|
|
|
Authors
|
|
|
|
-------
|
|
|
|
Vicious, written by:
|
|
|
|
Adrian C. (anrxc) <anrxc@sysphere.org>
|
|
|
|
|
2009-09-07 23:02:56 +02:00
|
|
|
Wicked, written by:
|
2009-07-30 04:44:22 +02:00
|
|
|
Lucas de Vries <lucas@glacicle.com>
|