2009-09-29 23:08:18 +02:00
|
|
|
Vicious
|
|
|
|
-------
|
2009-10-10 00:24:23 +02:00
|
|
|
Vicious is a modular widget library for the "awesome" window manager,
|
2009-07-30 04:44:22 +02:00
|
|
|
derived from the "Wicked" widget library. It has some of the old
|
2009-10-10 00:24:23 +02:00
|
|
|
Wicked widget types, a few of them rewritten, and a good number of new
|
|
|
|
ones:
|
2009-09-20 15:30:30 +02:00
|
|
|
|
2009-10-08 01:42:53 +02:00
|
|
|
http://git.sysphere.org/vicious/about/
|
2009-07-30 04:44:22 +02:00
|
|
|
|
2009-10-10 00:24:23 +02:00
|
|
|
Vicious widget types are a framework for creating your own widgets.
|
|
|
|
Before using a widget type *you* need to ensure that a valid source of
|
|
|
|
information exists.
|
|
|
|
|
2009-07-30 04:44:22 +02:00
|
|
|
|
|
|
|
Usage
|
|
|
|
-----
|
2009-10-10 00:24:23 +02:00
|
|
|
To use vicious move it to your awesome configuration directory in
|
|
|
|
$XDG_CONFIG_HOME (usually ~/.config):
|
2009-07-30 04:44:22 +02:00
|
|
|
|
2009-10-10 00:24:23 +02:00
|
|
|
$ mv vicious $XDG_CONFIG_HOME/awesome/
|
2009-07-30 04:44:22 +02:00
|
|
|
|
2009-10-10 00:24:23 +02:00
|
|
|
Your first step should be editing init.lua to comment out all the
|
|
|
|
widget types you don't need from the "Configure widgets" list. It is
|
|
|
|
not required but I suggest you do so to avoid having useless modules
|
|
|
|
sitting in your memory.
|
2009-09-14 20:55:53 +02:00
|
|
|
|
2009-10-10 00:24:23 +02:00
|
|
|
Then add the following to the top of your rc.lua:
|
|
|
|
|
|
|
|
require("vicious")
|
2009-09-20 15:30:30 +02:00
|
|
|
|
2009-10-10 00:24:23 +02:00
|
|
|
Once you create a widget (a textbox, graph or a progressbar) call
|
2009-09-14 20:55:53 +02:00
|
|
|
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-09-20 15:30:30 +02:00
|
|
|
widget
|
|
|
|
- widget created with widget() or awful.widget() (in case of a
|
|
|
|
graph or a progressbar)
|
2009-09-19 21:41:53 +02:00
|
|
|
|
2009-09-20 15:30:30 +02:00
|
|
|
type
|
|
|
|
- one of the available widget types, see below for a list
|
2009-09-19 21:41:53 +02:00
|
|
|
|
2009-09-20 15:30:30 +02:00
|
|
|
format
|
|
|
|
- string argument or a function
|
|
|
|
- $1, $2, $3... will be replaced by their respective value
|
|
|
|
returned by the widget type, some widget types return tables
|
|
|
|
with custom keys, in that case use: ${key}
|
|
|
|
- function
|
|
|
|
- function(widget, args) can be used to manipulate data
|
|
|
|
returned by the widget type, more about this below
|
2009-09-19 21:41:53 +02:00
|
|
|
|
2009-09-20 15:30:30 +02:00
|
|
|
interval
|
|
|
|
- number of seconds between updates of the widget, 2s by
|
|
|
|
default, also read the "Power" section below
|
2009-09-19 21:41:53 +02:00
|
|
|
|
2009-09-20 15:30:30 +02:00
|
|
|
warg
|
|
|
|
- some widget types require an argument to be passed, for example
|
|
|
|
the battery ID
|
2009-07-30 04:44:22 +02:00
|
|
|
|
|
|
|
|
2009-10-02 22:46:12 +02:00
|
|
|
Other functions
|
2009-07-30 04:44:22 +02:00
|
|
|
---------------
|
2009-09-20 15:30:30 +02:00
|
|
|
Unregister a widget:
|
2009-07-30 04:44:22 +02:00
|
|
|
vicious.unregister(widget, keep)
|
|
|
|
|
2009-10-10 00:24:23 +02:00
|
|
|
- if keep is true widget will be suspended, waiting to be
|
|
|
|
activated
|
2009-09-20 15:30:30 +02:00
|
|
|
|
|
|
|
Suspend all widgets:
|
2009-07-30 04:44:22 +02:00
|
|
|
vicious.suspend()
|
|
|
|
|
2009-09-20 15:30:30 +02:00
|
|
|
- example automation script for the "laptop-mode-tools" start-stop
|
|
|
|
module: http://sysphere.org/~anrxc/local/sources/lmt-vicious.sh
|
2009-09-07 23:02:56 +02:00
|
|
|
|
2009-09-20 15:30:30 +02:00
|
|
|
Restart suspended widgets:
|
2009-07-30 04:44:22 +02:00
|
|
|
vicious.activate(widget)
|
|
|
|
|
2009-10-10 00:24:23 +02:00
|
|
|
- if widget is provided only that widget will be activated
|
2009-07-30 04:44:22 +02:00
|
|
|
|
2009-09-25 21:31:20 +02:00
|
|
|
Enable caching for a widget:
|
|
|
|
vicious.enable_caching(widget_type)
|
|
|
|
|
|
|
|
- enable caching of values returned by a widget type
|
|
|
|
|
2009-07-30 04:44:22 +02:00
|
|
|
|
2009-10-08 01:42:53 +02:00
|
|
|
Power and Caching
|
|
|
|
-----------------
|
2009-09-20 15:30:30 +02:00
|
|
|
When a lot of widgets are in use they, and awesome, can generate a lot
|
|
|
|
of wake-ups and also be very expensive for system resources. This is
|
|
|
|
especially important when running on battery power. Suspending widgets
|
2009-10-10 00:24:23 +02:00
|
|
|
is one way to prevent them from draining your battery.
|
2009-09-20 15:30:30 +02:00
|
|
|
|
2009-10-08 01:42:53 +02:00
|
|
|
Update intervals also play a big role, and you can save a lot of power
|
|
|
|
with a smart approach. Avoid intervals like: 5, 10, 30, 60... to avoid
|
|
|
|
harmonics. If you take the 60-second mark as an example, all of your
|
|
|
|
widgets would be executed at that point. Instead think about using
|
|
|
|
only prime numbers, in that case you will have only a few widgets
|
|
|
|
executed at any given time interval. When choosing intervals also
|
|
|
|
consider what a widget actually does. Some widget types read files
|
|
|
|
that reside in memory, others call external utilities and some, like
|
|
|
|
the mbox widget, read big files.
|
|
|
|
|
2009-09-25 21:31:20 +02:00
|
|
|
Vicious can also cache values returned by widget types. Caching
|
2009-10-08 01:42:53 +02:00
|
|
|
enables you to have multiple widgets using the same widget type. With
|
|
|
|
caching its worker function gets executed only once - which is also
|
|
|
|
great for saving power.
|
2009-09-20 15:30:30 +02:00
|
|
|
|
2009-10-08 01:42:53 +02:00
|
|
|
- Some widget types keep internal data and if you call one multiple
|
|
|
|
times without caching, the widget that executes it first would
|
|
|
|
modify stored values. This can lead to problems and give you
|
|
|
|
inconsistent data. Remember it for widget types like CPU and
|
|
|
|
Network usage, which compare the old set of data with the new one
|
2009-10-10 00:24:23 +02:00
|
|
|
to calculate current usage.
|
2009-10-08 01:42:53 +02:00
|
|
|
|
|
|
|
- Widget types that require a widget argument to be passed should be
|
|
|
|
handled carefully. If you are requesting information for different
|
|
|
|
devices then caching should not be used, because you could get
|
|
|
|
inconsistent data.
|
2009-07-30 04:44:22 +02:00
|
|
|
|
|
|
|
|
|
|
|
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-10-10 00:24:23 +02:00
|
|
|
- returns 1st value as usage of all CPUs/cores, 2nd as usage of
|
|
|
|
first CPU/core, 3rd as usage of second CPU/core etc.
|
2009-07-30 04:44:22 +02:00
|
|
|
|
2009-08-06 18:21:13 +02:00
|
|
|
vicious.widgets.cpuinf
|
|
|
|
- provides speed and cache information for all available CPUs/cores
|
2009-10-10 00:24:23 +02:00
|
|
|
- returns a table with custom keys, using CPU ID as a base:
|
|
|
|
{cpu0 mhz}, {cpu0 ghz}, {cpu0 kb}, {cpu0 mb}, {cpu1 mhz} etc.
|
2009-08-06 18:21:13 +02:00
|
|
|
|
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-10-10 00:24:23 +02:00
|
|
|
- returns 1st value as frequency of requested CPU in MHz, 2nd in
|
|
|
|
GHz, 3rd as voltage in mV, 4th as voltage in V and 5th as the
|
|
|
|
governor state
|
2009-08-03 04:40:55 +02:00
|
|
|
|
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"
|
2009-10-10 00:24:23 +02:00
|
|
|
- returns 1st value as temperature of requested thermal zone
|
2009-07-30 04:44:22 +02:00
|
|
|
|
|
|
|
vicious.widgets.load
|
|
|
|
- provides system load averages for the past 1, 5, and 15 minutes
|
2009-10-10 00:24:23 +02:00
|
|
|
- returns 1st value as load average for past 1 minute, 2nd for 5
|
|
|
|
minutes and 3rd for 15 minutes
|
2009-07-30 04:44:22 +02:00
|
|
|
|
|
|
|
vicious.widgets.uptime
|
|
|
|
- provides system uptime information
|
2009-10-10 00:24:23 +02:00
|
|
|
- returns 1st value as total uptime, 2nd as uptime in days, 3rd as
|
|
|
|
uptime in hours, 4th as uptime in minutes and 5th as uptime in
|
|
|
|
seconds
|
2009-07-30 04:44:22 +02:00
|
|
|
|
|
|
|
vicious.widgets.bat
|
|
|
|
- provides state, charge, and remaining time for a requested battery
|
|
|
|
- takes battery ID as an argument, i.e. "BAT0"
|
2009-10-10 00:24:23 +02:00
|
|
|
- returns 1st value as state of requested battery, 2nd as charge
|
|
|
|
level in percent and 3rd as remaining (charging or discharging)
|
|
|
|
time
|
2009-07-30 04:44:22 +02:00
|
|
|
|
|
|
|
vicious.widgets.batat
|
|
|
|
- provides state, charge, and remaining time for all batteries using
|
|
|
|
acpitool
|
2009-10-10 00:24:23 +02:00
|
|
|
- returns 1st value as state of the first battery, 2nd as charge
|
|
|
|
level in percent, 3rd as remaining (charging or discharging) time,
|
|
|
|
4th as state of the second battery etc.
|
2009-07-30 04:44:22 +02:00
|
|
|
|
|
|
|
vicious.widgets.mem
|
|
|
|
- provides RAM and Swap usage statistics
|
2009-10-10 00:24:23 +02:00
|
|
|
- returns 1st value as memory usage in percent, 2nd as memory usage,
|
|
|
|
3rd as total system memory, 4th as free memory, 5th as swap usage
|
|
|
|
in percent, 6th as swap usage, 7th as total system swap and 8th as
|
|
|
|
free swap
|
2009-07-30 04:44:22 +02:00
|
|
|
|
|
|
|
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-10-10 00:24:23 +02:00
|
|
|
- returns a table with custom keys, using mount points as a base:
|
|
|
|
{/ size}, {/ used}, {/ avail}, {/ usep}, {/home size} etc.
|
2009-07-30 04:44:22 +02:00
|
|
|
|
|
|
|
vicious.widgets.dio
|
|
|
|
- provides I/O statistics for requested storage devices
|
2009-10-07 22:31:06 +02:00
|
|
|
- takes the disk as an argument, i.e. "hda"
|
2009-10-10 00:24:23 +02:00
|
|
|
- returns a table with custom keys: {raw}, {kb} and {mb}
|
2009-07-30 04:44:22 +02:00
|
|
|
|
2009-08-06 02:41:46 +02:00
|
|
|
vicious.widgets.hddtemp
|
|
|
|
- provides hard drive temperatures using the hddtemp daemon
|
2009-09-19 21:41:53 +02:00
|
|
|
- takes the hddtemp listening port as an argument, or defaults to
|
|
|
|
port 7634
|
2009-10-10 00:24:23 +02:00
|
|
|
- returns a table with custom keys, using hard drives as a base:
|
|
|
|
{/dev/hda} and {/dev/sda} for example
|
2009-08-06 02:41:46 +02:00
|
|
|
|
2009-07-30 04:44:22 +02:00
|
|
|
vicious.widgets.net
|
|
|
|
- provides usage statistics for all network interfaces
|
2009-10-10 00:24:23 +02:00
|
|
|
- returns a table with custom keys, using net interfaces as a base:
|
|
|
|
{eth0 rx_b}, {eth0 tx_b}, {eth0 rx_kb}, {eth0 tx_kb}, {eth0 rx_mb},
|
|
|
|
{eth0 tx_mb}, {eth0 rx_gb}, {eth0 tx_gb}, {eth0 down}, {eth0 up},
|
|
|
|
{eth0 down_b}, {eth0 up_b}, {eth0 down_kb}, {eth0 up_kb},
|
|
|
|
{eth0 down_mb}, {eth0 up_mb}, {eth0 down_gb}, {eth0 up_gb},
|
|
|
|
{eth1 rx_b} etc.
|
2009-07-30 04:44:22 +02:00
|
|
|
|
|
|
|
vicious.widgets.wifi
|
|
|
|
- provides wireless information for a requested interface
|
|
|
|
- takes the network interface as an argument, i.e. "wlan0"
|
2009-10-10 00:24:23 +02:00
|
|
|
- returns a table with custom keys: {ssid}, {mode}, {chan}, {rate},
|
|
|
|
{link} and {sign}
|
2009-07-30 04:44:22 +02:00
|
|
|
|
|
|
|
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-10-10 00:24:23 +02:00
|
|
|
- returns 1st value as the subject of the last e-mail
|
2009-07-30 04:44:22 +02:00
|
|
|
|
2009-07-31 07:49:28 +02:00
|
|
|
vicious.widgets.mboxc
|
2009-10-01 11:46:28 +02:00
|
|
|
- provides the count of total, old and new messages in mbox files
|
|
|
|
- takes a table with full paths to mbox files as an argument
|
2009-10-10 00:24:23 +02:00
|
|
|
- returns 1st value as the total count of messages, 2nd as the count
|
|
|
|
of old messages and 3rd as the count of new messages
|
2009-07-31 07:49:28 +02:00
|
|
|
|
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-10-10 00:24:23 +02:00
|
|
|
- returns 1st value as the count of new messages and 2nd as the
|
|
|
|
count of "old" messages lacking the Seen flag
|
2009-07-30 04:44:22 +02:00
|
|
|
|
2009-09-08 22:46:59 +02:00
|
|
|
vicious.widgets.gmail
|
2009-10-01 12:11:21 +02:00
|
|
|
- provides count of new and subject of last e-mail on Gmail
|
2009-10-10 00:24:23 +02:00
|
|
|
- returns a table with custom keys: {count} and {subject}
|
2009-09-08 22:46:59 +02:00
|
|
|
|
2009-07-30 04:44:22 +02:00
|
|
|
vicious.widgets.entropy
|
|
|
|
- provides available system entropy
|
2009-10-02 20:20:37 +02:00
|
|
|
- takes the poolsize as an argument, or uses Linux 2.6 default
|
|
|
|
entropy pool of 4096-bits
|
2009-10-10 00:24:23 +02:00
|
|
|
- returns 1st value as available system entropy and 2nd value as
|
|
|
|
available entropy in percent
|
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-10-10 00:24:23 +02:00
|
|
|
- returns 1st value as count of tasks you forgot to do, 2nd as count
|
|
|
|
of tasks for today, 3rd as count of tasks for the next 3 days and
|
|
|
|
4th as count of tasks to do in the week
|
2009-07-30 04:44:22 +02:00
|
|
|
|
|
|
|
vicious.widgets.pacman
|
|
|
|
- provides number of pending updates on Arch Linux
|
2009-10-10 00:24:23 +02:00
|
|
|
- returns 1st value as the count of available updates
|
2009-07-30 04:44:22 +02:00
|
|
|
|
|
|
|
vicious.widgets.mpd
|
|
|
|
- provides the currently playing song in MPD
|
2009-10-10 00:24:23 +02:00
|
|
|
- returns 1st value as the currently playing song
|
2009-07-30 04:44:22 +02:00
|
|
|
|
|
|
|
vicious.widgets.volume
|
|
|
|
- provides volume levels of requested ALSA mixers
|
|
|
|
- takes the ALSA channel as an argument, i.e. "Master"
|
2009-10-10 00:24:23 +02:00
|
|
|
- returns 1st value as the volume level of the requested channel
|
2009-07-30 04:44:22 +02:00
|
|
|
|
|
|
|
vicious.widgets.weather
|
|
|
|
- provides weather information for a requested station
|
2009-09-20 15:30:30 +02:00
|
|
|
- takes the ICAO station code as an argument, i.e. "LDRI"
|
2009-10-10 00:24:23 +02:00
|
|
|
- returns a table with custom keys: {city}, {wind}, {windmph},
|
|
|
|
{windkmh}, {sky}, {weather}, {tempf}, {tempc}, {humid}, {press}
|
2009-07-30 04:44:22 +02:00
|
|
|
|
|
|
|
vicious.widgets.date
|
|
|
|
- provides access to os.date, with optional custom formatting;
|
|
|
|
provided as the format string
|
2009-10-10 00:24:23 +02:00
|
|
|
- returns the output of os.date(), formatted by provided sequences
|
2009-07-30 04:44:22 +02:00
|
|
|
|
|
|
|
|
|
|
|
Custom widget types
|
|
|
|
-------------------
|
2009-10-10 00:24:23 +02:00
|
|
|
Use any of the existing widget types as a starting point for your
|
2009-09-14 20:55:53 +02:00
|
|
|
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-10-10 00:24:23 +02:00
|
|
|
defined in rc.lua (or somewhere else, outside the actual module).
|
2009-07-30 04:44:22 +02:00
|
|
|
|
|
|
|
|
|
|
|
Usage examples
|
|
|
|
--------------
|
2009-10-10 00:24:23 +02:00
|
|
|
Start with a simple widget, like date. Then build your setup from
|
|
|
|
there, one widget at a time. Also remember that besides creating and
|
|
|
|
registering widgets you have to add them to a wibox (statusbar) in
|
|
|
|
order to actually display them.
|
2009-07-30 04:44:22 +02:00
|
|
|
|
2009-10-10 00:24:23 +02:00
|
|
|
Date widget
|
2009-10-14 01:14:50 +02:00
|
|
|
datewidget = widget({ type = 'textbox' })
|
2009-10-10 00:24:23 +02:00
|
|
|
vicious.register(datewidget, vicious.widgets.date, '%b %d, %R')
|
2009-07-30 04:44:22 +02:00
|
|
|
|
2009-10-12 18:15:12 +02:00
|
|
|
- updated every 2 seconds (the default interval), uses standard
|
2009-10-10 00:24:23 +02:00
|
|
|
date sequences as the format string
|
2009-07-30 04:44:22 +02:00
|
|
|
|
|
|
|
Memory widget
|
2009-10-14 01:14:50 +02:00
|
|
|
memwidget = widget({ type = 'textbox' })
|
2009-09-25 21:31:20 +02:00
|
|
|
vicious.enable_caching(vicious.widgets.mem)
|
2009-09-19 21:41:53 +02:00
|
|
|
vicious.register(memwidget, vicious.widgets.mem, '$1 ($2MB/$3MB)', 13)
|
2009-07-30 04:44:22 +02:00
|
|
|
|
2009-10-12 18:15:12 +02:00
|
|
|
- updated every 13 seconds, appends "MB" to 2nd and 3rd returned
|
2009-09-25 21:31:20 +02:00
|
|
|
values and enables caching of this widget type
|
2009-07-30 04:44:22 +02:00
|
|
|
|
2009-08-06 02:41:46 +02:00
|
|
|
HDD temperature widget
|
2009-10-14 01:14:50 +02:00
|
|
|
hddtempwidget = widget({ type = 'textbox' })
|
2009-09-19 21:41:53 +02:00
|
|
|
vicious.register(hddtempwidget, vicious.widgets.hddtemp, '${/dev/sda}°C', 19)
|
2009-08-06 02:41:46 +02:00
|
|
|
|
2009-10-12 18:15:12 +02:00
|
|
|
- updated every 19 seconds, requests the temperature level of the
|
2009-10-10 00:24:23 +02:00
|
|
|
{/dev/sda} key/disk and appends "°C" to the returned value, does
|
2009-09-19 21:41:53 +02:00
|
|
|
not provide the port argument so default port is used
|
2009-08-06 02:41:46 +02:00
|
|
|
|
2009-07-30 04:44:22 +02:00
|
|
|
Mbox widget
|
2009-10-14 01:14:50 +02:00
|
|
|
mboxwidget = widget({ type = 'textbox' })
|
2009-09-19 21:41:53 +02:00
|
|
|
vicious.register(mboxwidget, vicious.widgets.mbox, '$1', 5, '/home/user/mail/Inbox')
|
2009-07-30 04:44:22 +02:00
|
|
|
|
2009-10-12 18:15:12 +02:00
|
|
|
- updated every 5 seconds, provides full path to the mbox as an
|
2009-07-30 04:44:22 +02:00
|
|
|
argument
|
|
|
|
|
2009-09-21 02:01:12 +02:00
|
|
|
Battery widget
|
2009-10-12 18:15:12 +02:00
|
|
|
batwidget = awful.widget.progressbar()
|
2009-09-21 02:01:12 +02:00
|
|
|
batwidget:set_width(8)
|
|
|
|
batwidget:set_height(10)
|
|
|
|
batwidget:set_vertical(true)
|
|
|
|
batwidget:set_background_color('#494B4F')
|
|
|
|
batwidget:set_border_color(nil)
|
|
|
|
batwidget:set_color('#AECF96')
|
2009-10-12 18:15:12 +02:00
|
|
|
batwidget:set_gradient_colors({ '#AECF96', '#88A175', '#FF5656' })
|
2009-09-21 02:01:12 +02:00
|
|
|
vicious.register(batwidget, vicious.widgets.bat, '$2', 61, 'BAT0')
|
|
|
|
|
2009-10-12 18:15:12 +02:00
|
|
|
- updated every 61 seconds, requests the current battery charge
|
2009-10-02 20:20:37 +02:00
|
|
|
level and displays a progressbar, provides "BAT0" battery ID as an
|
2009-09-21 02:01:12 +02:00
|
|
|
argument
|
|
|
|
|
|
|
|
CPU usage widget
|
2009-10-12 18:15:12 +02:00
|
|
|
cpuwidget = awful.widget.graph()
|
2009-09-21 02:01:12 +02:00
|
|
|
cpuwidget:set_width(50)
|
|
|
|
cpuwidget:set_background_color('#494B4F')
|
|
|
|
cpuwidget:set_color('#FF5656')
|
2009-10-12 18:15:12 +02:00
|
|
|
cpuwidget:set_gradient_colors({ '#FF5656', '#88A175', '#AECF96' })
|
2009-09-21 02:01:12 +02:00
|
|
|
vicious.register(cpuwidget, vicious.widgets.cpu, '$1', 3)
|
|
|
|
|
2009-10-12 18:15:12 +02:00
|
|
|
- updated every 3 seconds, feeds the graph with total usage
|
2009-09-21 02:01:12 +02:00
|
|
|
percentage of all CPUs/cores
|
|
|
|
|
2009-07-30 04:44:22 +02:00
|
|
|
|
2009-10-10 00:24:23 +02:00
|
|
|
Format functions
|
|
|
|
----------------
|
|
|
|
You can use a function instead of a string as the format parameter.
|
|
|
|
Then you are able to check the value returned by the widget type and
|
|
|
|
change it or perform some action. You can change the color of the
|
2009-10-12 18:15:12 +02:00
|
|
|
battery widget when it goes below a certain point, hide widgets when
|
|
|
|
they return a certain value or maybe use string.format for padding.
|
2009-07-30 04:44:22 +02:00
|
|
|
|
2009-10-10 00:24:23 +02:00
|
|
|
- Do not confuse this with just coloring the widget, in those cases
|
|
|
|
standard markup can be inserted into the format string.
|
|
|
|
|
|
|
|
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.
|
|
|
|
|
2009-10-12 18:15:12 +02:00
|
|
|
Example
|
2009-10-14 01:14:50 +02:00
|
|
|
mpdwidget = widget({ type = 'textbox' })
|
2009-10-10 00:24:23 +02:00
|
|
|
vicious.register(mpdwidget,vicious.widgets.mpd,
|
|
|
|
function (widget, args)
|
|
|
|
if args[1] == "Stopped" then return ''
|
|
|
|
else return '<span color="white">MPD:</span> '..args[1]
|
|
|
|
end
|
|
|
|
end)
|
|
|
|
|
2009-10-12 18:15:12 +02:00
|
|
|
- hides the mpd widget when there is no song playing, updated every
|
2009-10-10 00:24:23 +02:00
|
|
|
2 seconds (the default interval)
|
2009-07-30 04:44:22 +02:00
|
|
|
|
2009-10-12 18:15:12 +02:00
|
|
|
Example
|
2009-10-14 01:14:50 +02:00
|
|
|
uptimewidget = widget({ type = 'textbox' })
|
2009-10-12 18:15:12 +02:00
|
|
|
vicious.register(uptimewidget, vicious.widgets.uptime,
|
|
|
|
function (widget, args)
|
|
|
|
return string.format('Uptime: %2dd %02d:%02d ', args[2], args[3], args[4])
|
|
|
|
end, 61)
|
|
|
|
|
|
|
|
- uses string.format for padding uptime values to a minimum amount
|
|
|
|
of digits, updated every 61 seconds
|
|
|
|
|
2009-07-30 04:44:22 +02:00
|
|
|
|
|
|
|
Other
|
|
|
|
-----
|
2009-10-10 00:24:23 +02:00
|
|
|
Read "awesome" manual pages:
|
2009-07-30 04:44:22 +02:00
|
|
|
|
2009-09-29 23:08:18 +02:00
|
|
|
awesome(1) awesomerc(5)
|
2009-07-30 04:44:22 +02:00
|
|
|
|
2009-10-10 00:24:23 +02:00
|
|
|
Authors "awesome" configuration:
|
|
|
|
|
|
|
|
http://git.sysphere.org/awesome-configs/
|
|
|
|
|
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>
|