patches/
doc/conky.1
README
+\r
+*.bak
\ No newline at end of file
#! /bin/sh
# Guess values for system-dependent variables and create Makefiles.
-# Generated by GNU Autoconf 2.61 for Conky 1.8.5.
+# Generated by GNU Autoconf 2.61 for Conky 1.8.5_pre2390.
#
# Report bugs to <brenden1@users.sourceforge.net>.
#
# Identity of this package.
PACKAGE_NAME='Conky'
PACKAGE_TARNAME='conky'
-PACKAGE_VERSION='1.8.5'
-PACKAGE_STRING='Conky 1.8.5'
+PACKAGE_VERSION='1.8.5_pre2390'
+PACKAGE_STRING='Conky 1.8.5_pre2390'
PACKAGE_BUGREPORT='brenden1@users.sourceforge.net'
# Factoring default headers for most tests.
# Omit some internal or obsolete options to make the list less imposing.
# This message is too long to be a string in the A/UX 3.1 sh.
cat <<_ACEOF
-\`configure' configures Conky 1.8.5 to adapt to many kinds of systems.
+\`configure' configures Conky 1.8.5_pre2390 to adapt to many kinds of systems.
Usage: $0 [OPTION]... [VAR=VALUE]...
if test -n "$ac_init_help"; then
case $ac_init_help in
- short | recursive ) echo "Configuration of Conky 1.8.5:";;
+ short | recursive ) echo "Configuration of Conky 1.8.5_pre2390:";;
esac
cat <<\_ACEOF
test -n "$ac_init_help" && exit $ac_status
if $ac_init_version; then
cat <<\_ACEOF
-Conky configure 1.8.5
+Conky configure 1.8.5_pre2390
generated by GNU Autoconf 2.61
Copyright (C) 1992, 1993, 1994, 1995, 1996, 1998, 1999, 2000, 2001,
This file contains any messages produced by compilers while
running configure, to aid debugging if configure makes a mistake.
-It was created by Conky $as_me 1.8.5, which was
+It was created by Conky $as_me 1.8.5_pre2390, which was
generated by GNU Autoconf 2.61. Invocation command line was
$ $0 $@
# Define the identity of the package.
PACKAGE=conky
- VERSION=1.8.5
+ VERSION=1.8.5_pre2390
cat >>confdefs.h <<_ACEOF
pkg_cv_Audacious_CFLAGS="$Audacious_CFLAGS"
else
if test -n "$PKG_CONFIG" && \
- { (echo "$as_me:$LINENO: \$PKG_CONFIG --exists --print-errors \"audacious >= 1.4.0 dbus-glib-1 glib-2.0 gobject-2.0\"") >&5
- ($PKG_CONFIG --exists --print-errors "audacious >= 1.4.0 dbus-glib-1 glib-2.0 gobject-2.0") 2>&5
+ { (echo "$as_me:$LINENO: \$PKG_CONFIG --exists --print-errors \"audacious >= 1.4.0 audclient dbus-glib-1 glib-2.0 gobject-2.0\"") >&5
+ ($PKG_CONFIG --exists --print-errors "audacious >= 1.4.0 audclient dbus-glib-1 glib-2.0 gobject-2.0") 2>&5
ac_status=$?
echo "$as_me:$LINENO: \$? = $ac_status" >&5
(exit $ac_status); }; then
- pkg_cv_Audacious_CFLAGS=`$PKG_CONFIG --cflags "audacious >= 1.4.0 dbus-glib-1 glib-2.0 gobject-2.0" 2>/dev/null`
+ pkg_cv_Audacious_CFLAGS=`$PKG_CONFIG --cflags "audacious >= 1.4.0 audclient dbus-glib-1 glib-2.0 gobject-2.0" 2>/dev/null`
else
pkg_failed=yes
fi
pkg_cv_Audacious_LIBS="$Audacious_LIBS"
else
if test -n "$PKG_CONFIG" && \
- { (echo "$as_me:$LINENO: \$PKG_CONFIG --exists --print-errors \"audacious >= 1.4.0 dbus-glib-1 glib-2.0 gobject-2.0\"") >&5
- ($PKG_CONFIG --exists --print-errors "audacious >= 1.4.0 dbus-glib-1 glib-2.0 gobject-2.0") 2>&5
+ { (echo "$as_me:$LINENO: \$PKG_CONFIG --exists --print-errors \"audacious >= 1.4.0 audclient dbus-glib-1 glib-2.0 gobject-2.0\"") >&5
+ ($PKG_CONFIG --exists --print-errors "audacious >= 1.4.0 audclient dbus-glib-1 glib-2.0 gobject-2.0") 2>&5
ac_status=$?
echo "$as_me:$LINENO: \$? = $ac_status" >&5
(exit $ac_status); }; then
- pkg_cv_Audacious_LIBS=`$PKG_CONFIG --libs "audacious >= 1.4.0 dbus-glib-1 glib-2.0 gobject-2.0" 2>/dev/null`
+ pkg_cv_Audacious_LIBS=`$PKG_CONFIG --libs "audacious >= 1.4.0 audclient dbus-glib-1 glib-2.0 gobject-2.0" 2>/dev/null`
else
pkg_failed=yes
fi
_pkg_short_errors_supported=no
fi
if test $_pkg_short_errors_supported = yes; then
- Audacious_PKG_ERRORS=`$PKG_CONFIG --short-errors --errors-to-stdout --print-errors "audacious >= 1.4.0 dbus-glib-1 glib-2.0 gobject-2.0"`
+ Audacious_PKG_ERRORS=`$PKG_CONFIG --short-errors --errors-to-stdout --print-errors "audacious >= 1.4.0 audclient dbus-glib-1 glib-2.0 gobject-2.0"`
else
- Audacious_PKG_ERRORS=`$PKG_CONFIG --errors-to-stdout --print-errors "audacious >= 1.4.0 dbus-glib-1 glib-2.0 gobject-2.0"`
+ Audacious_PKG_ERRORS=`$PKG_CONFIG --errors-to-stdout --print-errors "audacious >= 1.4.0 audclient dbus-glib-1 glib-2.0 gobject-2.0"`
fi
# Put the nasty error message in config.log where it belongs
echo "$Audacious_PKG_ERRORS" >&5
- { { echo "$as_me:$LINENO: error: Package requirements (audacious >= 1.4.0 dbus-glib-1 glib-2.0 gobject-2.0) were not met:
+ { { echo "$as_me:$LINENO: error: Package requirements (audacious >= 1.4.0 audclient dbus-glib-1 glib-2.0 gobject-2.0) were not met:
$Audacious_PKG_ERRORS
and Audacious_LIBS to avoid the need to call pkg-config.
See the pkg-config man page for more details.
" >&5
-echo "$as_me: error: Package requirements (audacious >= 1.4.0 dbus-glib-1 glib-2.0 gobject-2.0) were not met:
+echo "$as_me: error: Package requirements (audacious >= 1.4.0 audclient dbus-glib-1 glib-2.0 gobject-2.0) were not met:
$Audacious_PKG_ERRORS
if test x$want_apcupsd = xyes; then
- if test x"$uname" != xLinux; then
+ if test x"$uname" != xLinux -a x"$uname" != xFreeBSD; then
{ echo "$as_me:$LINENO: apcupsd not supported on $uname... disabling" >&5
echo "$as_me: apcupsd not supported on $uname... disabling" >&6;}
want_apcupsd="not supported on $uname"
if test x$want_iostats = xyes; then
- if test x"$uname" != xLinux; then
+ if test x"$uname" != xLinux -a x"$uname" != xFreeBSD; then
{ echo "$as_me:$LINENO: iostats not supported on $uname... disabling" >&5
echo "$as_me: iostats not supported on $uname... disabling" >&6;}
want_iostats="not supported on $uname"
fi
fi
-if test x$want_alsa = xyes; then
-
-cat >>confdefs.h <<\_ACEOF
-#define MIXER_IS_ALSA 1
-_ACEOF
-
-fi
# report actual input values of CONFIG_FILES etc. instead of their
# values after options handling.
ac_log="
-This file was extended by Conky $as_me 1.8.5, which was
+This file was extended by Conky $as_me 1.8.5_pre2390, which was
generated by GNU Autoconf 2.61. Invocation command line was
CONFIG_FILES = $CONFIG_FILES
_ACEOF
cat >>$CONFIG_STATUS <<_ACEOF
ac_cs_version="\\
-Conky config.status 1.8.5
+Conky config.status 1.8.5_pre2390
configured by $0, generated by GNU Autoconf 2.61,
with options \\"`echo "$ac_configure_args" | sed 's/^ //; s/[\\""\`\$]/\\\\&/g'`\\"
ALSA mixer: $want_alsa
apcupsd: $want_apcupsd
I/O stats: $want_iostats
+ ncurses: $want_ncurses
* Lua ($want_lua) bindings:
Cairo: $want_lua_cairo
m4_define([conky_version_major], [1])
m4_define([conky_version_minor], [8])
m4_define([conky_version_micro], [5])
-m4_define([conky_version_tag]) dnl, [pre]) dnl [] for releases
-m4_define([conky_version_revision],[_rc3])
+m4_define([conky_version_tag], [pre]) dnl [] for releases
+m4_define([conky_version_revision],[_pre2390])
m4_define([conky_version],
[conky_version_major().conky_version_minor().conky_version_micro()ifelse(
conky_version_tag(), [pre],
AM_CONDITIONAL(BUILD_AUDACIOUS, test x$want_audacious = xyes -o x$want_audacious = xlegacy)
if test x$want_audacious = xyes; then
- PKG_CHECK_MODULES([Audacious], [audacious >= 1.4.0 dbus-glib-1 glib-2.0 gobject-2.0])
+ PKG_CHECK_MODULES([Audacious], [audacious >= 1.4.0 audclient dbus-glib-1 glib-2.0 gobject-2.0])
conky_CFLAGS="$conky_CFLAGS $Audacious_CFLAGS"
conky_LIBS="$conky_LIBS $Audacious_LIBS"
save_CPPFLAGS="$CPPFLAGS"
[want_apcupsd="$enableval"], [want_apcupsd=yes])
if test x$want_apcupsd = xyes; then
- if test x"$uname" != xLinux; then
+ if test x"$uname" != xLinux -a x"$uname" != xFreeBSD; then
AC_MSG_NOTICE([apcupsd not supported on $uname... disabling])
want_apcupsd="not supported on $uname"
else
[want_iostats="$enableval"], [want_iostats=yes])
if test x$want_iostats = xyes; then
- if test x"$uname" != xLinux; then
+ if test x"$uname" != xLinux -a x"$uname" != xFreeBSD; then
AC_MSG_NOTICE([iostats not supported on $uname... disabling])
want_iostats="not supported on $uname"
else
if test x$want_alsa = xyes; then
AC_CHECK_LIB(asound, snd_pcm_open,conky_LIBS="$conky_LIBS -lasound", want_alsa=no)
fi
-if test x$want_alsa = xyes; then
-AC_DEFINE(MIXER_IS_ALSA, 1, [Define if the mixers use ALSA])
-fi
dnl
dnl Some headers
dnl
ALSA mixer: $want_alsa
apcupsd: $want_apcupsd
I/O stats: $want_iostats
+ ncurses: $want_ncurses
* Lua ($want_lua) bindings:
Cairo: $want_lua_cairo
#
dnl major, minor and micro version macros.
m4_define([conky_version_major], [1])
-m4_define([conky_version_minor], [8])
-m4_define([conky_version_micro], [5])
+m4_define([conky_version_minor], [9])
+m4_define([conky_version_micro], [6])
m4_define([conky_version_tag], [pre]) dnl [] for releases
m4_define([conky_version_revision],[_pre@REVISION@])
m4_define([conky_version],
-conky (1.9.5-1) unstable; urgency=low
+conky (1.9.6-1) unstable; urgency=low
* New maemo release:
- i'm too lazy to fill this in for now
Build-Depends: debhelper (>= 5.0.0), libtool, automake,
pkg-config (>= 0.19), libx11-dev, libxft-dev,
libxdamage-dev, libxext-dev, libglib2.0-dev,
- libxml2-dev, libimlib2-dev,
+ libxml2-dev, libimlib2-dev (>= 1.4.0),
libiw-dev[!kfreebsd-i386 !kfreebsd-amd64 !hurd-i386],
libasound2-dev [!kfreebsd-i386 !kfreebsd-amd64 !hurd-i386],
libkvm-dev [kfreebsd-i386 kfreebsd-amd64],
@HAVE_DOCSTUFF_TRUE@ sed -i "s/\xE2//g" README
@HAVE_DOCSTUFF_TRUE@ sed -i "s/\x80//g" README
@HAVE_DOCSTUFF_TRUE@ sed -i "s/\x90/-/g" README
+@HAVE_DOCSTUFF_TRUE@ sed -i "s/\x94/-/g" README
+@HAVE_DOCSTUFF_TRUE@ sed -i "s/\x9f/-/g" README
@HAVE_DOCSTUFF_TRUE@ mv README ${top_srcdir}
@HAVE_DOCSTUFF_TRUE@ xsltproc ${srcdir}/variables.xsl ${srcdir}/variables.xml > variables.html
@HAVE_DOCSTUFF_TRUE@ xsltproc ${srcdir}/config_settings.xsl ${srcdir}/config_settings.xml > config_settings.html
#include <Imlib2.h>
#include <X11/Xlib.h>
#define _userdata void*
-
+#define TOLUA_DISABLE_tolua_imlib2_imlib_get_next_font_in_fallback_chain00
+#define TOLUA_DISABLE_tolua_imlib2_imlib_insert_font_into_fallback_chain00
+#define TOLUA_DISABLE_tolua_imlib2_imlib_remove_font_from_fallback_chain00
+#define TOLUA_DISABLE_tolua_imlib2_imlib_get_prev_font_in_fallback_chain00
/* function to release collected object via destructor */
#ifdef __cplusplus
tolua_function(tolua_S,"imlib_context_pop",tolua_imlib2_imlib_context_pop00);
tolua_function(tolua_S,"imlib_context_get",tolua_imlib2_imlib_context_get00);
tolua_function(tolua_S,"imlib_context_set_display",tolua_imlib2_imlib_context_set_display00);
- tolua_function(tolua_S,"imlib_context_disconnect_display",tolua_imlib2_imlib_context_disconnect_display00);
+ //tolua_function(tolua_S,"imlib_context_disconnect_display",tolua_imlib2_imlib_context_disconnect_display00);
tolua_function(tolua_S,"imlib_context_set_visual",tolua_imlib2_imlib_context_set_visual00);
tolua_function(tolua_S,"imlib_context_set_colormap",tolua_imlib2_imlib_context_set_colormap00);
tolua_function(tolua_S,"imlib_context_set_drawable",tolua_imlib2_imlib_context_set_drawable00);
tolua_function(tolua_S,"imlib_image_tile",tolua_imlib2_imlib_image_tile00);
tolua_function(tolua_S,"imlib_load_font",tolua_imlib2_imlib_load_font00);
tolua_function(tolua_S,"imlib_free_font",tolua_imlib2_imlib_free_font00);
- tolua_function(tolua_S,"imlib_insert_font_into_fallback_chain",tolua_imlib2_imlib_insert_font_into_fallback_chain00);
+/* tolua_function(tolua_S,"imlib_insert_font_into_fallback_chain",tolua_imlib2_imlib_insert_font_into_fallback_chain00);
tolua_function(tolua_S,"imlib_remove_font_from_fallback_chain",tolua_imlib2_imlib_remove_font_from_fallback_chain00);
tolua_function(tolua_S,"imlib_get_prev_font_in_fallback_chain",tolua_imlib2_imlib_get_prev_font_in_fallback_chain00);
- tolua_function(tolua_S,"imlib_get_next_font_in_fallback_chain",tolua_imlib2_imlib_get_next_font_in_fallback_chain00);
+ tolua_function(tolua_S,"imlib_get_next_font_in_fallback_chain",tolua_imlib2_imlib_get_next_font_in_fallback_chain00);*/
tolua_function(tolua_S,"imlib_text_draw",tolua_imlib2_imlib_text_draw00);
tolua_function(tolua_S,"imlib_text_draw_with_return_metrics",tolua_imlib2_imlib_text_draw_with_return_metrics00);
tolua_function(tolua_S,"imlib_get_text_size",tolua_imlib2_imlib_get_text_size00);
--- /dev/null
+do
+ package.path = "/home/user/MyDocs/lua/?.lua" --loads all lua files from here
+ require 'text' --specify each one we really want again like this, text = text.lua
+ require 'graph'
+ require 'bargraph_eng'
+ require 'misc'
+ require 'luatraverse'
+ require 'strict'
+
+ --local count
+
+ function conky_main() --conky will run this if you specified to load 'main' in the conf
+ conky_main_bars()
+ conky_main_graph()
+ conky_draw_text()
+ --collectgarbage(collect)
+ --local y = traverse.countreferences(deleteme)
+ --print (tostring(y))
+ --count = #(_G)
+ --local run = true
+ --io.output("/home/user/MyDocs/lua/lua.log")
+ --for n,v in pairs(_G) do
+ -- io.write (tostring(n)," ",tostring(v),"\n")
+ --end
+ --io.write (tostring(count))
+ --print (count)
+ end
+end
\ No newline at end of file
--- /dev/null
+
+
+--[[ BARGRAPH WIDGET
+ v2.0 by wlourf (12.07.2010)
+ this widget draws a bargraph with different effects
+ http://u-scripts.blogspot.com/2010/07/bargraph-widget.html
+
+
+Parameters are :
+3 parameters are mandatory
+name - the name of the conky variable to display, for example for {$cpu cpu0}, just write name="cpu"
+arg - the argument of the above variable, for example for {$cpu cpu0}, just write arg="cpu0"
+ arg can be a numerical value if name=""
+max - the maximum value the above variable can reach, for example, for {$cpu cpu0}, just write max=100
+
+Optional parameters:
+x,y - coordinates of the starting point of the bar, default = middle of the conky window
+cap - end of cap line, ossibles values are r,b,s (for round, butt, square), default="b"
+ http://www.cairographics.org/samples/set_line_cap/
+angle - angle of rotation of the bar in degress, default = 0 (i.e. a vertical bar)
+ set to 90 for an horizontal bar
+skew_x - skew bar around x axis, default = 0
+skew_y - skew bar around y axis, default = 0
+blocks - number of blocks to display for a bar (values >0) , default= 10
+height - height of a block, default=10 pixels
+width - width of a block, default=20 pixels
+space - space between 2 blocks, default=2 pixels
+angle_bar - this angle is used to draw a bar on a circular way (ok, this is no more a bar !) default=0
+radius - for cicular bars, internal radius, default=0
+ with radius, parameter width has no more effect.
+
+Colours below are defined into braces {colour in hexadecimal, alpha}
+fg_colour - colour of a block ON, default= {0x00FF00,1}
+bg_colour - colour of a block OFF, default = {0x00FF00,0.5}
+alarm - threshold, values after this threshold will use alarm_colour colour , default=max
+alarm_colour - colour of a block greater than alarm, default=fg_colour
+smooth - (true or false), create a gradient from fg_colour to bg_colour, default=false
+mid_colour - colours to add to gradient, with this syntax {position into the gradient (0 to1), colour hexa, alpha}
+ for example, this table {{0.25,0xff0000,1},{0.5,0x00ff00,1},{0.75,0x0000ff,1}} will add
+ 3 colurs to gradient created by fg_colour and alarm_colour, default=no mid_colour
+led_effect - add LED effects to each block, default=no led_effect
+ if smooth=true, led_effect is not used
+ possibles values : "r","a","e" for radial, parallelel, perdendicular to the bar (just try!)
+ led_effect has to be used with theses colours :
+fg_led - middle colour of a block ON, default = fg_colour
+bg_led - middle colour of a block OFF, default = bg_colour
+alarm_led - middle colour of a block > ALARM, default = alarm_colour
+
+reflection parameters, not avaimable for circular bars
+reflection_alpha - add a reflection effect (values from 0 to 1) default = 0 = no reflection
+ other values = starting opacity
+reflection_scale - scale of the reflection (default = 1 = height of text)
+reflection_length - length of reflection, define where the opacity will be set to zero
+ calues from 0 to 1, default =1
+reflection - position of reflection, relative to a vertical bar, default="b"
+ possibles values are : "b","t","l","r" for bottom, top, left, right
+
+
+v1.0 (10 Feb. 2010) original release
+v1.1 (13 Feb. 2010) numeric values can be passed instead conky stats with parameters name="", arg = numeric_value
+v1.2 (28 Feb. 2010) just renamed the widget to bargraph
+v1.3 (03 March 2010) added parameters radius & angle_bar to draw the bar in a circular way
+v2.0 (12 Jul. 2010) rewrite script + add reflection effects and parameters are now set into tables
+]]
+
+require 'cairo'
+
+----------------START OF PARAMETERS ----------
+function conky_main_bars()
+ local bars_settings={
+
+ {
+ name="fs_used",
+ arg="/",
+ max=conky_parse("${to_bytes ${fs_size /}}"),
+ --alarm=1,--no alarm with 1 smooth block, don't do extra work here
+ bg_colour={0x00ff00,0.25},
+ fg_colour={0x00ff00,1},
+ alarm_colour={0xff0000,1},
+ x=5,y=112,
+ angle=90,
+ blocks=1,
+ height=210,width=18,
+ smooth=true,
+ mid_colour={{0.5,0xffff00,1}},
+ },
+
+ {
+ name="fs_used",
+ arg="/home",
+ max=conky_parse("${to_bytes ${fs_size /home}}"),
+ --alarm=1,--no alarm with 1 smooth block, don't do extra work here
+ bg_colour={0x00ff00,0.25},
+ fg_colour={0x00ff00,1},
+ alarm_colour={0xff0000,1},
+ x=5,y=132,
+ angle=90,
+ blocks=1,
+ height=210,width=18,
+ smooth=true,
+ mid_colour={{0.5,0xffff00,1}},
+ },
+ {
+ name="fs_used",
+ arg="/home/user/MyDocs",
+ max=conky_parse("${to_bytes ${fs_size /home/user/MyDocs}}"),
+ --alarm=1,--no alarm with 1 smooth block, don't do extra work here
+ bg_colour={0x00ff00,0.25},
+ fg_colour={0x00ff00,1},
+ alarm_colour={0xff0000,1},
+ x=5,y=152,
+ angle=90,
+ blocks=1,
+ height=210,width=18,
+ smooth=true,
+ mid_colour={{0.5,0xffff00,1}},
+ DrawMe=conky_parse("${if_mounted /home/user/MyDocs}1$endif")
+ },
+ {
+ name="fs_used",
+ arg="/media/mmc1",
+ max=conky_parse("${to_bytes ${fs_size /media/mmc1}}"),
+ --alarm=1,--no alarm with 1 smooth block, don't do extra work here
+ bg_colour={0x00ff00,0.25},
+ fg_colour={0x00ff00,1},
+ alarm_colour={0xff0000,1},
+ x=5,y=172,
+ angle=90,
+ blocks=1,
+ height=210,width=18,
+ smooth=true,
+ mid_colour={{0.5,0xffff00,1}},
+ DrawMe=conky_parse("${if_mounted /media/mmc1}1$endif")
+ },
+ {
+ name="mem",
+ arg="",
+ max=conky_parse("${to_bytes ${memmax}}"),
+ alarm=100,
+ bg_colour={0x00ff00,0.25},
+ fg_colour={0x00ff00,1},
+ alarm_colour={0xff0000,1},
+ x=9,y=95,
+ angle=90,
+ blocks=18,
+ height=10,width=18,
+ smooth=true,
+ --mid_colour={{0.5,0xffff00,1}},
+ },
+ {
+ name="battery_percent",
+ arg="",
+ max=100,
+ angle=90,
+ alarm=25,
+ alarm_colour={0x00ffff,0.5},
+ bg_colour={0x00ffff,0.5},
+ fg_colour={0xff0000,0.5},
+ led_effect="e",
+ bg_led ={0x0000ff,1},
+ fg_led ={0xffff00,1},
+ x=575,y=40,
+ skew_y=15,
+ },
+ {
+ name="wireless_link_qual_perc",
+ arg="wlan0",
+ max=100,
+ angle=270,
+ bg_colour={0x00ff33,0},
+ fg_colour={0x00ff33,1},
+ blocks=10,
+ x=390,y=225,
+ height=3,
+ cap="b",
+ angle_bar=20,
+ radius=9,
+ mid_colour={{0,0xFF0000,1},{0.5,0xff0000,1},{0.7,0xffff00,1},{0.85,0x00ff33,1}},
+ smooth = true,
+ DrawMe=conky_parse("${if_empty ${wireless_essid wlan0}}${else}1$endif"),
+ },
+ {
+ name="wireless_link_qual_perc",
+ arg="wlan0",
+ max=100,
+ angle=90,
+ bg_colour={0x00ff33,0},
+ fg_colour={0x00ff33,1},
+ blocks=10,
+ x=410,y=225,
+ height=3,
+ cap="b",
+ angle_bar=20,
+ radius=9,
+ mid_colour={{0,0xFF0000,1},{0.5,0xff0000,1},{0.7,0xffff00,1},{0.85,0x00ff33,1}},
+ smooth = true,
+ DrawMe=conky_parse("${if_empty ${wireless_essid wlan0}}${else}1$endif"),
+ },
+ {
+ name="cell_radio_percent",
+ arg="",
+ max=100,
+ bg_colour={0x00ff33,0},
+ fg_colour={0x00ff33,1},
+ blocks=10,
+ x=445,
+ y=49,
+ height=3,
+ cap="b",
+ angle_bar=20,
+ angle=90,
+ radius=9,
+ mid_colour={{0,0xFF0000,1},{0.5,0xff0000,1},{0.7,0xffff00,1},{0.85,0x00ff33,1}},
+ smooth = true,
+ --DrawMe=conky_parse("${if_up gprs0}1$endif")
+ },
+ }
+
+ if conky_window == nil then return end
+ local cs = cairo_xlib_surface_create(conky_window.display, conky_window.drawable, conky_window.visual, conky_window.width, conky_window.height)
+ cr = cairo_create(cs)
+ --prevent segmentation error when reading cpu state
+ if tonumber(conky_parse('${updates}'))>3 then
+ for i in pairs(bars_settings) do
+ draw_multi_bar_graph(bars_settings[i])
+ end
+ end
+ cairo_destroy(cr)
+ cairo_surface_destroy(cs)
+ cr=nil
+end
+
+function draw_multi_bar_graph(t)
+ cairo_save(cr)
+ --check values
+ if t.DrawMe~=nil and t.DrawMe ~= "1" then return end
+ if t.name==nil and t.arg==nil then
+ print ("No input values ... use parameters 'name' with 'arg' or only parameter 'arg' ")
+ return
+ end
+ if t.max==nil then
+ print ("No maximum value defined, use 'max'")
+ return
+ end
+ if t.name==nil then t.name="" end
+ if t.arg==nil then t.arg="" end
+
+ --set default values
+ if t.x == nil then t.x = conky_window.width/2 end
+ if t.y == nil then t.y = conky_window.height/2 end
+ if t.blocks == nil then t.blocks=10 end
+ if t.height == nil then t.height=10 end
+ if t.angle == nil then t.angle=0 end
+ t.angle = t.angle*math.pi/180
+ --line cap style
+ if t.cap==nil then t.cap = "b" end
+ local cap="b"
+ for i,v in ipairs({"s","r","b"}) do
+ if v==t.cap then cap=v end
+ end
+ local delta=0
+ if t.cap=="r" or t.cap=="s" then delta = t.height end
+ if cap=="s" then cap = CAIRO_LINE_CAP_SQUARE
+ elseif cap=="r" then
+ cap = CAIRO_LINE_CAP_ROUND
+ elseif cap=="b" then
+ cap = CAIRO_LINE_CAP_BUTT
+ end
+ --end line cap style
+ --if t.led_effect == nil then t.led_effect="r" end
+ if t.width == nil then t.width=20 end
+ if t.space == nil then t.space=2 end
+ if t.radius == nil then t.radius=0 end
+ if t.angle_bar == nil then t.angle_bar=0 end
+ t.angle_bar = t.angle_bar*math.pi/360 --halt angle
+ --colours
+ if t.bg_colour == nil then t.bg_colour = {0x00FF00,0.5} end
+ if #t.bg_colour~=2 then t.bg_colour = {0x00FF00,0.5} end
+ if t.fg_colour == nil then t.fg_colour = {0x00FF00,1} end
+ if #t.fg_colour~=2 then t.fg_colour = {0x00FF00,1} end
+ if t.alarm_colour == nil then t.alarm_colour = t.fg_colour end
+ if #t.alarm_colour~=2 then t.alarm_colour = t.fg_colour end
+ if t.mid_colour ~= nil then
+ for i=1, #t.mid_colour do
+ if #t.mid_colour[i]~=3 then
+ print ("error in mid_color table")
+ t.mid_colour[i]={1,0xFFFFFF,1}
+ end
+ end
+ end
+ if t.bg_led ~= nil and #t.bg_led~=2 then t.bg_led = t.bg_colour end
+ if t.fg_led ~= nil and #t.fg_led~=2 then t.fg_led = t.fg_colour end
+ if t.alarm_led~= nil and #t.alarm_led~=2 then t.alarm_led = t.fg_led end
+ if t.led_effect~=nil then
+ if t.bg_led == nil then t.bg_led = t.bg_colour end
+ if t.fg_led == nil then t.fg_led = t.fg_colour end
+ if t.alarm_led == nil then t.alarm_led = t.fg_led end
+ end
+ if t.alarm==nil then t.alarm = t.max end --0.8*t.max end
+ if t.smooth == nil then t.smooth = false end
+ if t.skew_x == nil then
+ t.skew_x=0
+ else
+ t.skew_x = math.pi*t.skew_x/180
+ end
+ if t.skew_y == nil then
+ t.skew_y=0
+ else
+ t.skew_y = math.pi*t.skew_y/180
+ end
+ if t.reflection_alpha==nil then t.reflection_alpha=0 end
+ if t.reflection_length==nil then t.reflection_length=1 end
+ if t.reflection_scale==nil then t.reflection_scale=1 end
+ --end of default values
+
+ local function rgb_to_r_g_b(col_a)
+ return ((col_a[1] / 0x10000) % 0x100) / 255., ((col_a[1] / 0x100) % 0x100) / 255., (col_a[1] % 0x100) / 255., col_a[2]
+ end
+
+ --functions used to create patterns
+ local function create_smooth_linear_gradient(x0,y0,x1,y1)
+ local pat = cairo_pattern_create_linear (x0,y0,x1,y1)
+ cairo_pattern_add_color_stop_rgba (pat, 0, rgb_to_r_g_b(t.fg_colour))
+ cairo_pattern_add_color_stop_rgba (pat, 1, rgb_to_r_g_b(t.alarm_colour))
+ if t.mid_colour ~=nil then
+ for i=1, #t.mid_colour do
+ cairo_pattern_add_color_stop_rgba (pat, t.mid_colour[i][1], rgb_to_r_g_b({t.mid_colour[i][2],t.mid_colour[i][3]}))
+ end
+ end
+ return pat
+ end
+
+ local function create_smooth_radial_gradient(x0,y0,r0,x1,y1,r1)
+ local pat = cairo_pattern_create_radial (x0,y0,r0,x1,y1,r1)
+ cairo_pattern_add_color_stop_rgba (pat, 0, rgb_to_r_g_b(t.fg_colour))
+ cairo_pattern_add_color_stop_rgba (pat, 1, rgb_to_r_g_b(t.alarm_colour))
+ if t.mid_colour ~=nil then
+ for i=1, #t.mid_colour do
+ cairo_pattern_add_color_stop_rgba (pat, t.mid_colour[i][1], rgb_to_r_g_b({t.mid_colour[i][2],t.mid_colour[i][3]}))
+ end
+ end
+ return pat
+ end
+
+ local function create_led_linear_gradient(x0,y0,x1,y1,col_alp,col_led)
+ local pat = cairo_pattern_create_linear (x0,y0,x1,y1) ---delta, 0,delta+ t.width,0)
+ cairo_pattern_add_color_stop_rgba (pat, 0.0, rgb_to_r_g_b(col_alp))
+ cairo_pattern_add_color_stop_rgba (pat, 0.5, rgb_to_r_g_b(col_led))
+ cairo_pattern_add_color_stop_rgba (pat, 1.0, rgb_to_r_g_b(col_alp))
+ return pat
+ end
+
+ local function create_led_radial_gradient(x0,y0,r0,x1,y1,r1,col_alp,col_led,mode)
+ local pat = cairo_pattern_create_radial (x0,y0,r0,x1,y1,r1)
+ if mode==3 then
+ cairo_pattern_add_color_stop_rgba (pat, 0, rgb_to_r_g_b(col_alp))
+ cairo_pattern_add_color_stop_rgba (pat, 0.5, rgb_to_r_g_b(col_led))
+ cairo_pattern_add_color_stop_rgba (pat, 1, rgb_to_r_g_b(col_alp))
+ else
+ cairo_pattern_add_color_stop_rgba (pat, 0, rgb_to_r_g_b(col_led))
+ cairo_pattern_add_color_stop_rgba (pat, 1, rgb_to_r_g_b(col_alp))
+ end
+ return pat
+ end
+
+ local function draw_single_bar()
+ --this fucntion is used for bars with a single block (blocks=1) but
+ --the drawing is cut in 3 blocks : value/alarm/background
+ --not zvzimzblr for circular bar
+ local function create_pattern(col_alp,col_led,bg)
+ local pat
+ if not t.smooth then
+ if t.led_effect=="e" then
+ pat = create_led_linear_gradient (-delta, 0,delta+ t.width,0,col_alp,col_led)
+ elseif t.led_effect=="a" then
+ pat = create_led_linear_gradient (t.width/2, 0,t.width/2,-t.height,col_alp,col_led)
+ elseif t.led_effect=="r" then
+ pat = create_led_radial_gradient (t.width/2, -t.height/2, 0, t.width/2,-t.height/2,t.height/1.5,col_alp,col_led,2)
+ else
+ pat = cairo_pattern_create_rgba (rgb_to_r_g_b(col_alp))
+ end
+ else
+ if bg then
+ pat = cairo_pattern_create_rgba (rgb_to_r_g_b(t.bg_colour))
+ else
+ pat = create_smooth_linear_gradient(t.width/2, 0, t.width/2,-t.height)
+ end
+ end
+ return pat
+ end
+
+ local y1=-t.height*pct/100
+ local y2,y3=nil
+ if pct>(100*t.alarm/t.max) then
+ y1 = -t.height*t.alarm/100
+ y2 = -t.height*pct/100
+ if t.smooth then y1=y2 end
+ end
+
+ if t.angle_bar==0 then
+
+ --block for fg value
+ local pat = create_pattern(t.fg_colour,t.fg_led,false)
+ cairo_set_source(cr,pat)
+ cairo_rectangle(cr,0,0,t.width,y1)
+ cairo_fill(cr)
+ cairo_pattern_destroy(pat)
+ -- block for alarm value
+ if not t.smooth and y2 ~=nil then
+ pat = create_pattern(t.alarm_colour,t.alarm_led,false)
+ cairo_set_source(cr,pat)
+ cairo_rectangle(cr,0,y1,t.width,y2-y1)
+ cairo_fill(cr)
+ y3=y2
+ cairo_pattern_destroy(pat)
+ else
+ y2,y3=y1,y1
+ end
+ -- block for bg value
+ cairo_rectangle(cr,0,y2,t.width,-t.height-y3)
+ pat = create_pattern(t.bg_colour,t.bg_led,true)
+ cairo_set_source(cr,pat)
+ cairo_pattern_destroy(pat)
+ cairo_fill(cr)
+ end
+ end --end single bar
+
+ local function draw_multi_bar()
+ --function used for bars with 2 or more blocks
+ for pt = 1,t.blocks do
+ --set block y
+ local y1 = -(pt-1)*(t.height+t.space)
+ local light_on=false
+
+ --set colors
+ local col_alp = t.bg_colour
+ local col_led = t.bg_led
+ if pct>=(100/t.blocks) or pct>0 then --ligth on or not the block
+ if pct>=(pcb*(pt-1)) then
+ light_on = true
+ col_alp = t.fg_colour
+ col_led = t.fg_led
+ if pct>=(100*t.alarm/t.max) and (pcb*pt)>(100*t.alarm/t.max) then
+ col_alp = t.alarm_colour
+ col_led = t.alarm_led
+ end
+ end
+ end
+
+ --set colors
+ --have to try to create gradients outside the loop ?
+ local pat
+ if not t.smooth then
+ if t.angle_bar==0 then
+ if t.led_effect=="e" then
+ pat = create_led_linear_gradient (-delta, 0,delta+ t.width,0,col_alp,col_led)
+ elseif t.led_effect=="a" then
+ pat = create_led_linear_gradient (t.width/2, -t.height/2+y1,t.width/2,0+t.height/2+y1,col_alp,col_led)
+ elseif t.led_effect=="r" then
+ pat = create_led_radial_gradient (t.width/2, y1, 0, t.width/2,y1,t.width/1.5,col_alp,col_led,2)
+ else
+ pat = cairo_pattern_create_rgba (rgb_to_r_g_b(col_alp))
+ end
+ else
+ if t.led_effect=="a" then
+ pat = create_led_radial_gradient (0, 0, t.radius+(t.height+t.space)*(pt-1),
+ 0, 0, t.radius+(t.height+t.space)*(pt),
+ col_alp,col_led,3)
+ else
+ pat = cairo_pattern_create_rgba (rgb_to_r_g_b(col_alp))
+ end
+ end
+ else
+ if light_on then
+ if t.angle_bar==0 then
+ pat = create_smooth_linear_gradient(t.width/2, t.height/2, t.width/2,-(t.blocks-0.5)*(t.height+t.space))
+ else
+ pat = create_smooth_radial_gradient(0, 0, (t.height+t.space), 0,0,(t.blocks+1)*(t.height+t.space),2)
+ end
+ else
+ pat = cairo_pattern_create_rgba (rgb_to_r_g_b(t.bg_colour))
+ end
+ end
+ cairo_set_source (cr, pat)
+ cairo_pattern_destroy(pat)
+
+ --draw a block
+ if t.angle_bar==0 then
+ cairo_move_to(cr,0,y1)
+ cairo_line_to(cr,t.width,y1)
+ else
+ cairo_arc( cr,0,0,
+ t.radius+(t.height+t.space)*(pt)-t.height/2,
+ -t.angle_bar -math.pi/2 ,
+ t.angle_bar -math.pi/2)
+ end
+ cairo_stroke(cr)
+ end
+ end
+
+ local function setup_bar_graph()
+ --function used to retrieve the value to display and to set the cairo structure
+ if t.blocks ~=1 then t.y=t.y-t.height/2 end
+ local value = 0
+ if t.name ~="" then
+ value = (conky_parse(string.format('${%s %s}', t.name, t.arg)))
+ if string.match(value,"%w") then
+ value = conky_parse(string.format('${to_bytes %s}',value))
+ end
+ value=tonumber(value)
+ else
+ value = tonumber(t.arg)
+ end
+ if value==nil then value =0 end
+ pct = 100*value/t.max
+ pcb = 100/t.blocks
+ cairo_set_line_width (cr, t.height)
+ cairo_set_line_cap (cr, cap)
+ cairo_translate(cr,t.x,t.y)
+ cairo_rotate(cr,t.angle)
+ local matrix0 = cairo_matrix_t:create()
+ tolua.takeownership(matrix0)
+ cairo_matrix_init (matrix0, 1,t.skew_y,t.skew_x,1,0,0)
+ cairo_transform(cr,matrix0)
+ --call the drawing function for blocks
+ if t.blocks==1 and t.angle_bar==0 then
+ draw_single_bar()
+ if t.reflection=="t" or t.reflection=="b" then cairo_translate(cr,0,-t.height) end
+ else
+ draw_multi_bar()
+ end
+ --call the drawing function for reflection and prepare the mask used
+ if t.reflection_alpha>0 and t.angle_bar==0 then
+ local pat2
+ local matrix1 = cairo_matrix_t:create()
+ tolua.takeownership(matrix1)
+ if t.angle_bar==0 then
+ pts={-delta/2,(t.height+t.space)/2,t.width+delta,-(t.height+t.space)*(t.blocks)}
+ if t.reflection=="t" then
+ cairo_matrix_init (matrix1,1,0,0,-t.reflection_scale,0,-(t.height+t.space)*(t.blocks-0.5)*2*(t.reflection_scale+1)/2)
+ pat2 = cairo_pattern_create_linear (t.width/2,-(t.height+t.space)*(t.blocks),t.width/2,(t.height+t.space)/2)
+ elseif t.reflection=="r" then
+ cairo_matrix_init (matrix1,-t.reflection_scale,0,0,1,delta+2*t.width,0)
+ pat2 = cairo_pattern_create_linear (delta/2+t.width,0,-delta/2,0)
+ elseif t.reflection=="l" then
+ cairo_matrix_init (matrix1,-t.reflection_scale,0,0,1,-delta,0)
+ pat2 = cairo_pattern_create_linear (-delta/2,0,delta/2+t.width,-0)
+ else --bottom
+ cairo_matrix_init (matrix1,1,0,0,-1*t.reflection_scale,0,(t.height+t.space)*(t.reflection_scale+1)/2)
+ pat2 = cairo_pattern_create_linear (t.width/2,(t.height+t.space)/2,t.width/2,-(t.height+t.space)*(t.blocks))
+ end
+ end
+ cairo_transform(cr,matrix1)
+ if t.blocks==1 and t.angle_bar==0 then
+ draw_single_bar()
+ cairo_translate(cr,0,-t.height/2)
+ else
+ draw_multi_bar()
+ end
+ cairo_set_line_width(cr,0.01)
+ cairo_pattern_add_color_stop_rgba (pat2, 0,0,0,0,1-t.reflection_alpha)
+ cairo_pattern_add_color_stop_rgba (pat2, t.reflection_length,0,0,0,1)
+ if t.angle_bar==0 then
+ cairo_rectangle(cr,pts[1],pts[2],pts[3],pts[4])
+ end
+ cairo_clip_preserve(cr)
+ cairo_set_operator(cr,CAIRO_OPERATOR_CLEAR)
+ cairo_stroke(cr)
+ cairo_mask(cr,pat2)
+ cairo_pattern_destroy(pat2)
+ cairo_set_operator(cr,CAIRO_OPERATOR_OVER)
+ end --reflection
+ pct,pcb=nil
+ end --setup_bar_graph()
+
+ --start here !
+ setup_bar_graph()
+ cairo_restore(cr)
+end
+
--- /dev/null
+--[[BOX WIDGET v1.0 by Wlourf 19/12/2010
+This widget can drawn some boxes, even circles in your conky window
+http://u-scripts.blogspot.com/ (HowTo coming soon)
+
+Inspired by Background by londonali1010 (2009)
+
+The parameters (all optionals) are :
+x - x coordinate of top-left corner of the box, default = 0 = (top-left corner of conky window)
+y - y coordinate of top-left corner of the box, default = 0 = (top-left corner of conky window)
+w - width of the box, default = width of the conky window
+h - height of the box, default = width of the conky window
+radius - radius of the corner, default = 0 = no radius
+mode - mode for drawing the radius, possible values are "circle" or "curve", default ="curve"
+linear_gradient - table with the coordinates of two points to define a linear gradient,
+ points are relative to top-left corner of the box, (not the conky window)
+ {x1,y1,x2,y2}
+radial_gradient - table with the coordinates of two circle to define a radial gradient,
+ colour={{0,0xCCCCCC,1},{1,0xCCCCCC,0}} points are relative to top-left corner of the box, (not the conky window)
+ {x1,y1,r1,x2,y2,r2} (r=radius)
+colour - table of colours, default = plain white {{1,0xFFFFFF,1}}
+ this table contains one or more tables with format {P,C,A}
+ P=position of gradient (0 = start of the gradient, 1= end of the gradient)
+ C=hexadecimal colour
+ A=alpha (opacity) of color (0=invisible,1=opacity 100%)
+ Examples :
+ for a plain color {{1,0x00FF00,0.5}}
+ for a gradient with two colours {{0,0x00FF00,0.5},{1,0x000033,1}}
+ or {{0.5,0x00FF00,1},{1,0x000033,1}} -with this one, gradient will start in the middle
+ for a gradient with three colours {{0,0x00FF00,0.5},{0.5,0x000033,1},{1,0x440033,1}}
+ and so on ...
+
+
+
+To call this script in Conky, use (assuming you have saved this script to ~/scripts/):
+ lua_load ~/scripts/draw_bg.lua
+ lua_draw_hook_pre main_box
+
+And leave one line blank or not after TEXT
+
+Changelog:
++ v1.0 -- Original release (19.12.2010)
+]]
+
+-- Change these settings to affect your background.
+
+table_settings={
+ {
+ x=5,
+ y=57,
+ h=40,
+ w=650,
+ linear_gradient = {300,200,550,350},
+ colour = {{0,0x000000,0.5},{1,0x000000,0.5}},
+ radius=20,
+ },
+ {
+ x=315,
+ y=100,
+ h=90,
+ w=485,
+ linear_gradient = {300,200,550,350},
+ colour = {{0,0x000000,0.2},{1,0x000000,0.1}},
+ radius=20,
+ },
+ {
+ x=5,
+ y=192,
+ h=44,
+ w=795,
+ linear_gradient = {300,200,550,350},
+ colour = {{0,0x000000,0.4},{1,0x000000,0.1}},
+ radius=20,
+ },
+ {
+ x=5,
+ y=355,
+ h=125,
+ w=795,
+ colour = {{0,0x000000,0.25}},
+ radius=20,
+ },
+ {
+ x=5,
+ y=240,
+ h=110,
+ w=795,
+ colour = {{0,0x000000,0.4}},
+ radius=20,
+ },
+
+--[[
+ { --backgound with gradient
+ radius=25,
+ mode="circle",
+ linear_gradient = {300,200,550,350},
+ colour={{0,0xCCCCCC,1},{1,0xCCCCCC,0}}
+ },
+
+
+
+
+ { --pink rounded box
+ x=25,
+ y=150,
+ h=200,
+ w=100,
+ colour = {{O,0xff00ff,0.5}},
+ radius=30,
+ mode="circle"
+ },
+ { --border for pink rounded box
+ x=25,
+ y=150,
+ h=200,
+ w=100,
+ radius=30,
+ border=3,
+ mode="circle",
+ colour={
+ {0,0x0000CC,1},
+ },
+ },
+
+ { --box with linear gradient
+ x=150,
+ y=150,
+ h=100,
+ w=100,
+ linear_gradient = {50,0,50,100 },
+ colour={
+ {0,0xffff00,1},
+ {0.5,0xff0000,1},
+ {1,0xff00ff,1},
+ },
+ },
+
+ { --box with radial gradient
+ x=150,
+ y=270,
+ h=100,
+ w=100,
+ radius=10,
+ radial_gradient = {20,20,0,20,20,100 },
+ colour={
+ {0,0xff0000,1},
+ {1,0xffff00,1},
+ },
+ mode="circle",
+ border=0
+ },
+ { --border for above box --gradient are inversed
+ x=150,
+ y=270,
+ h=100,
+ w=100,
+ radius=10,
+ radial_gradient = {20,20,0,20,20,100 },
+ colour={
+ {1,0xff0000,1},
+ {0,0xffff00,1},
+ },
+ mode="circle",
+ border=5
+ },
+
+
+ { --oh my god, a circle with radial gradient
+ x=300, y=30,
+ w=100,h=100,
+ mode="circle",
+ radius=50,
+ radial_gradient = {50,50,0,50,50,50 },
+ colour={
+ {0,0xff0000,1},
+ {1,0xffff00,1},
+ },
+ },
+
+ { --no name for this one ! radius > w or h !
+ x=300, y=250,
+ w=100,h=100,
+ mode="circle",
+ radius=100,
+ radial_gradient = {50,50,0,50,50,50 },
+ colour={
+ {0,0xff0000,1},
+ {0.5,0x0000ff,1},
+ {1,0xffff00,1},
+ },
+ },
+]]
+
+
+ }
+
+---------END OF PARAMETERS
+
+require 'cairo'
+
+
+
+function conky_main_box()
+ if conky_window==nil then return end
+ local cs=cairo_xlib_surface_create(conky_window.display, conky_window.drawable, conky_window.visual, conky_window.width, conky_window.height)
+ cr=cairo_create(cs)
+
+ for i in pairs(table_settings) do
+ draw_bg (table_settings[i])
+ end
+
+ cairo_destroy(cr)
+ cairo_surface_destroy(cs)
+end
+
+function draw_bg(t)
+ function rgba_to_r_g_b_a(tc)
+ --tc={position,colour,alpha}
+ local colour = tc[2]
+ local alpha = tc[3]
+ return ((colour / 0x10000) % 0x100) / 255., ((colour / 0x100) % 0x100) / 255., (colour % 0x100) / 255., alpha
+ end
+
+ local PI = math.pi
+
+ --check values and set default values
+ if t.x == nil then t.x = 0 end
+ if t.y == nil then t.y = 0 end
+ if t.w == nil then t.w = conky_window.width end
+ if t.h == nil then t.h = conky_window.height end
+ if t.radius == nil then t.radius = 0 end
+ if t.border == nil then t.border = 0 end
+ if t.colour==nil then t.colour={{1,0xFFFFFF,1}} end
+ if t.linear_gradient ~= nil then
+ if #t.linear_gradient ~= 4 then
+ t.linear_gradient = {t.x,t.y,t.width,t.height}
+ end
+ end
+ if t.radial_gradient ~= nil then
+ if #t.radial_gradient ~= 6 then
+ t.radial_gradient = {t.x,t.y,0, t.x,t.y, t.width}
+ end
+ end
+
+ for i=1, #t.colour do
+ if #t.colour[i]~=3 then
+ print ("error in color table")
+ t.colour[i]={1,0xFFFFFF,1}
+ end
+ end
+
+ --for better reading
+ t.linear = t.linear_gradient
+ t.radial = t.radial_gradient
+ t.no_gradient = (t.linear == nil ) and (t.radial == nil )
+
+ cairo_save(cr)
+ cairo_translate(cr, t.x, t.y)
+
+ if t.radius>0 then
+ if t.mode=="circle" then
+ cairo_arc(cr, t.radius, t.radius, t.radius, -PI, -PI/2)
+ cairo_line_to(cr,t.w-t.radius,0)
+ cairo_arc(cr, t.w-t.radius, t.radius, t.radius, -PI/2,0)
+ cairo_line_to(cr,t.w,t.h-t.radius)
+ cairo_arc(cr, t.w-t.radius, t.h-t.radius, t.radius, 0,PI/2)
+ cairo_line_to(cr,t.radius,t.h)
+ cairo_arc(cr, t.radius, t.h-t.radius, t.radius, PI/2,-PI)
+ cairo_line_to(cr,0,t.radius)
+ else
+ cairo_move_to(cr, t.radius, 0)
+ cairo_line_to(cr, t.w-t.radius, 0)
+ cairo_curve_to(cr, t.w, 0, t.w, 0, t.w, t.radius)
+ cairo_line_to(cr, t.w, t.h-t.radius)
+ cairo_curve_to(cr, t.w, t.h, t.w, t.h, t.w - t.radius, t.h)
+ cairo_line_to(cr, t.radius, t.h)
+ cairo_curve_to(cr, 0, t.h, 0, t.h, 0, t.h-t.radius)
+ cairo_line_to(cr, 0, t.radius)
+ cairo_curve_to(cr, 0, 0, 0, 0, t.radius,0)
+ end
+ cairo_close_path(cr)
+ else
+ cairo_rectangle(cr,0,0,t.w,t.h)
+ end
+
+ if t.no_gradient then
+ cairo_set_source_rgba(cr,rgba_to_r_g_b_a(t.colour[1]))
+ else
+ if t.linear ~= nil then
+ pat = cairo_pattern_create_linear (t.linear[1],t.linear[2],t.linear[3],t.linear[4])
+ elseif t.radial ~= nil then
+ pat = cairo_pattern_create_radial (t.radial[1],t.radial[2],t.radial[3],t.radial[4],t.radial[5],t.radial[6])
+ end
+ for i=1, #t.colour do
+ cairo_pattern_add_color_stop_rgba (pat, t.colour[i][1], rgba_to_r_g_b_a(t.colour[i]))
+ end
+ cairo_set_source (cr, pat)
+ cairo_pattern_destroy(pat)
+ end
+
+ if t.border>0 then
+ cairo_set_line_width(cr,t.border)
+ cairo_stroke(cr)
+ else
+ cairo_fill(cr)
+ end
+
+ cairo_restore(cr)
+end
+
--- /dev/null
+--[[ GRAPH widget v1.0 by wlourf (31.10.2010)
+ this widget draws some graphs with some effects
+ http://u-scripts.blogspot.com/2010/10/graph-widget.html
+
+To call the script in a conky, use, before TEXT
+ lua_load /path/to/the/script/graph.lua
+ lua_draw_hook_pre main_graph
+and add one line (blank or not) after TEXT
+
+
+Parameters are :
+3 parameters are mandatory
+name - the name of the conky variable to display,
+ for example for {$cpu cpu0}, just write name="cpu"
+arg - the argument of the above variable,
+ for example for {$cpu cpu1}, just write arg="cpu1"
+ arg can be a numerical value if name=""
+max - the maximum value the above variable can reach,
+ for example for {$cpu cpu1}, just write max=100 or less or more
+
+Optional parameters:
+x,y - coordinates of the bottom-left corner of the graph,
+ relative to the top-left corner of the conky window
+ default = bottom-left corner of the conky window
+width - width of the graph, default = 100 pixels
+height - height of the graph, default = 20 pixels
+nb_values - number of values to display in the graph, default=width
+ i.e. 1 pixel for 1 value
+autoscale - if set to true, calculate the max valeu of the y axis and
+ doesn't use the max parameter above, default=false
+skew_x - skew graph around x axis, défaut = 0
+skew_y - skew graph around y axis, défaut = 0
+angle - angle of rotation of the graph in degress, default = 0
+ i.e. a horizontal graph)
+inverse - if set to true, graph are draw from right to left, default=false
+background - if set to false, background is not drawn, default=true
+foreground - if set to false, foreground is not drawn, default=true
+ foreground = plain graph
+bg_bd_size - size of the border of the background, default=0=no border
+fg_bd_size - size of the border of the foreground, default=0=no border
+
+
+Colours tables below are defined into braces :
+{position in the gradient (0 to 1), colour in hexadecimal, alpha (0 to 1)}
+example for a single colour table :
+{{0,0xFFAA00,1}} position parameter doesn't matter
+example for a two-colours table :
+{{0,0xFFAA00,1},{1,0x00AA00,1}} or {{0.5,0xFFAA00,1},{1,0x00AA00,1}}
+example for a three-colours table :
+{{0,0xFFAA00,1},{0.5,0xFF0000,1},{1,0x00AA00,1}}
+
+bg_colour - colour table for background,
+ default = {{0,0x000000,.5},{1,0xFFFFFF,.5}}
+fg_colour - colour table for foreground,
+ default = {{0,0x00FFFF,1},{1,0x0000FF,1}}
+bg_bd_colour- colour table for background border,
+ default = {{1,0xFFFFFF,1}}
+fg_bd_colour- colour table for foreground border,
+ default = {{1,0xFFFF00,1}}
+
+bg_orientation, bg_bd_orientation, fg_orientation, fg_bd_orientation,
+ - "orientation" defines the starting point of the gradient,
+ default="nn"
+ there are 8 available starting points :
+ "nw","nn","ne","ee","se","ss","sw","ww"
+ (n for north, w for west ...)
+ theses 8 points are the 4 corners + the 4 middles of graph
+ so a gradient "nn" will go from "nn" to "ss"
+ a gradient "nw" will go from "nw" to "se"
+
+
+v1.0 (31 Oct. 2010) original release
+
+-- This program is free software; you can redistribute it and/or modify
+-- it under the terms of the GNU General Public License as published by
+-- the Free Software Foundation version 3 (GPLv3)
+--
+-- This program is distributed in the hope that it will be useful,
+-- but WITHOUT ANY WARRANTY; without even the implied warranty of
+-- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+-- GNU General Public License for more details.
+--
+-- You should have received a copy of the GNU General Public License
+-- along with this program; if not, write to the Free Software
+-- Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
+-- MA 02110-1301, USA.
+
+]]
+
+require 'cairo'
+
+function set_settings()
+ graph_settings={
+ {
+ name="cpu",
+ arg="",
+ max=100,
+ y=85,
+ x=5,
+ autoscale=false,
+ width=215,
+ height=30,
+ nb_values=120,
+ fg_bd_size=2,
+ bg_colour = {{0,0x007AF6,0},{1,0x000000,0}},
+ --fg_bd_colour = { {0,0xFF0000,1},{0.5,0xFFA209,1},{1,0xFFFF00,1}},
+ fg_bd_colour = { {0,0xFF0000,1},{0.5,0xFF3300,1},{1,0xFFFFFF,1}},
+ --fg_colour = { {0,0xFF0000,1},{0.5,0xFFA209,1},{1,0xFFFF00,1}},
+ fg_colour = { {0,0x00CCFF,0.7},{0.5,0x0000FF,0.7},{1,0x000000,0.1}},
+ foreground=true,
+ fg_orientation="ne",
+ bg_bd_orientation="nn",
+ bg_orientation="ne",
+ },
+ {
+ name="upspeedf",
+ arg="wlan0",
+ max=9999,
+ y=233,
+ x=5,
+ autoscale=true,
+ width=275,
+ height=35,
+ nb_values=120,
+ fg_bd_size=1,
+ bg_colour = {{0,0x007AF6,0},{1,0x000000,0}},
+ fg_bd_colour = { {0,0xFF0000,1},{0.5,0xFFA209,0.8},{1,0xFFFF00,0.6}},
+ fg_colour = { {0,0xFF0000,0.65},{0.5,0xFFA209,0.5},{1,0xFFFF00,0.3}},
+ foreground=true,
+ inverse=true,
+ DrawMe="${if_empty ${wireless_essid wlan0}}${else}1$endif",
+ bg_orientation="ww",
+ },
+ {
+ name="downspeedf",
+ arg="wlan0",
+ max=9999,
+ y=233,
+ x=525,
+ autoscale=true,
+ width=275,
+ height=35,
+ nb_values=120,
+ fg_bd_size=1,
+ bg_colour = {{0,0x007AF6,0},{1,0x000000,0}},
+ fg_bd_colour = { {0,0xFF0000,1},{0.5,0xFFA209,0.8},{1,0xFFFF00,0.6}},
+ fg_colour = { {0,0xFF0000,0.65},{0.5,0xFFA209,0.5},{1,0xFFFF00,0.3}},
+ foreground=true,
+ DrawMe="${if_empty ${wireless_essid wlan0}}${else}1$endif",
+ bg_orientation="ee",
+ },
+ {
+ name="upspeedf",
+ arg="gprs0",
+ max=9999,
+ y=230,
+ x=5,
+ autoscale=true,
+ width=275,
+ height=35,
+ nb_values=120,
+ fg_bd_size=1,
+ bg_colour = {{0,0x007AF6,0},{1,0x000000,0}},
+ fg_bd_colour = { {0,0xFF0000,1},{0.5,0xFFA209,1},{1,0xFFFF00,1}},
+ fg_colour = { {0,0xFF0000,1},{0.5,0xFFA209,1},{1,0xFFFF00,1}},
+ foreground=true,
+ inverse=true,
+ DrawMe="${if_up gprs0}1${else}0$endif",
+ bg_orientation="ww",
+ },
+ {
+ name="downspeedf",
+ arg="gprs0",
+ max=9999,
+ y=230,
+ x=525,
+ autoscale=true,
+ width=275,
+ height=35,
+ nb_values=120,
+ fg_bd_size=1,
+ bg_colour = {{0,0x007AF6,0},{1,0x000000,0}},
+ fg_bd_colour = { {0,0xFF0000,1},{0.5,0xFFA209,1},{1,0xFFFF00,1}},
+ fg_colour = { {0,0xFF0000,1},{0.5,0xFFA209,1},{1,0xFFFF00,1}},
+ foreground=true,
+ DrawMe="${if_up gprs0}1${else}0$endif",
+ bg_orientation="ee",
+ },
+ {
+ name="loadavg",
+ arg="1",
+ max=20,
+ y=95,
+ x=372,
+ autoscale=true,
+ width=140,
+ height=36,
+ nb_values=100,
+ fg_bd_size=0,
+ bg_colour = {{0,0x667AF6,0},{1,0x000000,0}},
+ fg_bd_colour = { {0,0xdd0000,0.7},{0.5,0xdddd00,0.7},{1,0xFFFF00,0.7}},
+ fg_colour = { {0,0x000000,0.7},{0.5,0xdd0000,0.7},{1,0xff0000,0.7}},
+ foreground=true,
+ },
+ {
+ name="to_bytes ${diskio",
+ arg="mmcblk0}",
+ max=2500000,
+ y=187,
+ x=640,
+ autoscale=true,
+ width=160,
+ height=89,
+ nb_values=130,
+ fg_bd_size=0,
+ bg_colour = {{0,0x667AF6,0},{1,0x000000,0}},
+ fg_bd_colour = { {0,0xdd0000,1},{0.5,0xdddd00,1},{1,0xFFFF00,1}},
+ fg_colour = { {1,0x111111,0.3},{0.5,0x33cc00,0.6},{0,0x00FF00,0.8}},
+ foreground=true,
+ bg_orientation="ne",
+ fg_orientation="ee",
+ },
+ }
+end
+
+function check_settings(t)
+ --tables are check only when conky start
+ if t.name==nil and t.arg==nil then
+ print ("No input values ... use parameters 'name'" ..
+ " with 'arg' or only parameter 'arg' ")
+ return 1
+ end
+ if t.max==nil then
+ print ("No maximum value defined, use 'max'")
+ print ("for name=" .. t.name .. " with arg=" .. t.arg)
+ return 1
+ end
+ if t.name==nil then t.name="" end
+ if t.arg==nil then t.arg="" end
+ return 0
+end
+
+function conky_main_graph()
+ if conky_window == nil then return end
+ local w=conky_window.width
+ local h=conky_window.height
+ local cs=cairo_xlib_surface_create(conky_window.display,
+ conky_window.drawable, conky_window.visual, w, h)
+ cr=cairo_create(cs)
+ updates=tonumber(conky_parse('${updates}'))
+ --start drawing after "updates_gap" updates
+ --prevent segmentation error for cpu
+ updates_gap=5
+ if updates==1 then
+ set_settings()
+ flagOK=0
+ for i in pairs(graph_settings) do
+ if graph_settings[i].width==nil then graph_settings[i].width=100 end
+ if graph_settings[i].nb_values==nil then
+ graph_settings[i].nb_values= graph_settings[i].width
+ end
+ --create an empty table to store values
+ graph_settings[i]["values"]={}
+ --beginning point
+ graph_settings[i].beg = graph_settings[i].nb_values
+ --graph_settings[i].beg = 0
+ for j =1, graph_settings[i].nb_values do
+ graph_settings[i].values[j]=0
+ end
+ graph_settings[i].flag_init=true
+ flagOK=flagOK + check_settings(graph_settings[i])
+ end
+ end
+ if flagOK>0 then
+ --abort script if error in one of the tables
+ print ("ERROR : Check the graph_setting table")
+ return
+ end
+ --drawing process
+ if updates > updates_gap then
+ for i in pairs(graph_settings) do
+ if (graph_settings[i].DrawMe==nil or conky_parse(graph_settings[i].DrawMe) == "1") then
+ --print(graph_settings[i].DrawMe.."= '"..conky_parse(graph_settings[i].DrawMe).."'")
+ --return
+ --cancel fetch value from conky if interface down or whatever
+ local nb_values=graph_settings[i].nb_values
+ graph_settings[i].automax=0
+ for j =1, nb_values do
+ if graph_settings[i].values[j+1]==nil then
+ graph_settings[i].values[j+1]=0
+ end
+ graph_settings[i].values[j]=graph_settings[i].values[j+1]
+ if j==nb_values then
+ --store value
+ if graph_settings[i].name=="" then
+ value=graph_settings[i].arg
+ else
+ value=tonumber(conky_parse('${' ..
+ graph_settings[i].name .. " " ..
+ graph_settings[i].arg ..'}'))
+ end
+ graph_settings[i].values[nb_values]=value
+ end
+ graph_settings[i].automax=math.max(graph_settings[i].automax,
+ graph_settings[i].values[j])
+ if graph_settings[i].automax == 0 then graph_settings[i].automax = 1 end --should stop weird glitches at beginning when no values reported yet for upspeed or diskio
+ end
+ draw_graph(graph_settings[i])
+ end
+ end
+ end
+ cairo_destroy(cr)
+ cairo_surface_destroy(cs)
+ updates=nil
+ updates_gap=nil
+end
+
+function draw_graph(t)
+ --drawing function
+ local function rgb_to_r_g_b(colour)
+ return ((colour[2] / 0x10000) % 0x100) / 255., ((colour[2] / 0x100) % 0x100) / 255., (colour[2] % 0x100) / 255., colour[3]
+ end
+
+ local function linear_orientation(o,w,h)
+ --set gradient for bg and bg border
+ local p
+ if o=="nn" then
+ p={w/2,h,w/2,0}
+ elseif o=="ne" then
+ p={w,h,0,0}
+ elseif o=="ww" then
+ p={0,h/2,w,h/2}
+ elseif o=="se" then
+ p={w,0,0,h}
+ elseif o=="ss" then
+ p={w/2,0,w/2,h}
+ elseif o=="ee" then
+ p={w,h/2,0,h/2}
+ elseif o=="sw" then
+ p={0,0,w,h}
+ elseif o=="nw" then
+ p={0,h,w,0}
+ end
+ return p
+ end
+
+ local function linear_orientation_inv(o,w,h)
+ --set gradient for fg and fg border
+ local p
+ if o=="ss" then
+ p={w/2,h,w/2,0}
+ elseif o=="sw" then
+ p={w,h,0,0}
+ elseif o=="ee" then
+ p={0,h/2,w,h/2}
+ elseif o=="nw" then
+ p={w,0,0,h}
+ elseif o=="nn" then
+ p={w/2,0,w/2,h}
+ elseif o=="ww" then
+ p={w,h/2,0,h/2}
+ elseif o=="ne" then
+ p={0,0,w,h}
+ elseif o=="se" then
+ p={0,h,w,0}
+ end
+ return p
+ end
+ if t.DrawMe~=nil and conky_parse(t.DrawMe) ~= "1" then
+ --print(t.DrawMe.."= '"..conky_parse(t.DrawMe).."'")
+ return
+ --else
+ -- print(t.name)
+ end --cancel drawing for same reason as earlier
+ --set default values
+ if t.height==nil then t.height=20 end
+ --checked in previous part : width and nb_values
+ if t.background==nil then t.background=true end
+ if t.bg_bd_size==nil then t.bg_bd_size=0 end
+ if t.x==nil then t.x=t.bg_bd_size end
+ if t.y==nil then t.y=conky_window.height -t.bg_bd_size end
+ if t.bg_colour==nil then t.bg_colour={{0,0x000000,.5},{1,0xFFFFFF,.5}} end
+ if t.bg_bd_colour==nil then t.bg_bd_colour={{1,0xFFFFFF,1}} end
+ if t.foreground==nil then t.foreground=true end
+ if t.fg_colour==nil then t.fg_colour={{0,0x00FFFF,1},{1,0x0000FF,1}} end
+ if t.fg_bd_size==nil then t.fg_bd_size=0 end
+ if t.fg_bd_colour==nil then t.fg_bd_colour={{1,0xFFFF00,1}} end
+ if t.autoscale==nil then t.autoscale=false end
+ if t.inverse==nil then t.inverse=false end
+ if t.angle==nil then t.angle=0 end
+ if t.bg_bd_orientation==nil then t.bg_bd_orientation="nn" end
+ if t.bg_orientation==nil then t.bg_orientation="nn" end
+ if t.fg_bd_orientation==nil then t.fg_bd_orientation="nn" end
+ if t.fg_orientation==nil then t.fg_orientation="nn" end
+ --check colours tables
+ for i=1, #t.fg_colour do
+ if #t.fg_colour[i]~=3 then
+ print ("error in fg_colour table")
+ t.fg_colour[i]={1,0x0000FF,1}
+ end
+ end
+ for i=1, #t.fg_bd_colour do
+ if #t.fg_bd_colour[i]~=3 then
+ print ("error in fg_bd_colour table")
+ t.fg_bd_colour[i]={1,0x00FF00,1}
+ end
+ end
+ for i=1, #t.bg_colour do
+ if #t.bg_colour[i]~=3 then
+ print ("error in background color table")
+ t.bg_colour[i]={1,0xFFFFFF,0.5}
+ end
+ end
+ for i=1, #t.bg_bd_colour do
+ if #t.bg_bd_colour[i]~=3 then
+ print ("error in background border color table")
+ t.bg_bd_colour[i]={1,0xFFFFFF,1}
+ end
+ end
+ --calculate skew parameters if needed
+ if t.flag_init then
+ if t.skew_x == nil then
+ t.skew_x=0
+ else
+ t.skew_x = math.pi*t.skew_x/180
+ end
+ if t.skew_y == nil then
+ t.skew_y=0
+ else
+ t.skew_y = math.pi*t.skew_y/180
+ end
+ t.flag_init=false
+ end
+ cairo_set_line_cap(cr,CAIRO_LINE_CAP_ROUND)
+ cairo_set_line_join(cr,CAIRO_LINE_JOIN_ROUND)
+ local matrix0 = cairo_matrix_t:create()
+ tolua.takeownership(matrix0)
+ cairo_save(cr)
+ cairo_matrix_init (matrix0, 1,t.skew_y,t.skew_x,1,0,0)
+ cairo_transform(cr,matrix0)
+ local ratio=t.width/t.nb_values
+ cairo_translate(cr,t.x,t.y)
+ cairo_rotate(cr,t.angle*math.pi/180)
+ cairo_scale(cr,1,-1)
+ --background
+ if t.background then
+ local pts=linear_orientation(t.bg_orientation,t.width,t.height)
+ local pat = cairo_pattern_create_linear (pts[1],pts[2],pts[3],pts[4])
+ for i=1, #t.bg_colour do
+ --print ("i",i,t.colour[i][1], rgb_to_r_g_b(t.colour[i]))
+ cairo_pattern_add_color_stop_rgba (pat, t.bg_colour[i][1], rgb_to_r_g_b(t.bg_colour[i]))
+ end
+ cairo_set_source (cr, pat)
+ cairo_rectangle(cr,0,0,t.width,t.height)
+ cairo_fill(cr)
+ cairo_pattern_destroy(pat)
+ end
+ --autoscale
+ cairo_save(cr)
+ if t.autoscale then
+ t.max= t.automax*1.1
+ end
+ local scale_x = t.width/(t.nb_values-1)
+ local scale_y = t.height/t.max
+ --define first point of the graph
+ if updates-updates_gap <t.nb_values then
+ t.beg = t.beg - 1
+ --next line prevent segmentation error when conky window is redraw
+ --quicly when another window "fly" over it
+ if t.beg<0 then t.beg=0 end
+ else
+ t.beg=0
+ end
+ if t.inverse then cairo_scale(cr,-1,1)
+ cairo_translate(cr,-t.width,0) end
+ --graph foreground
+ if t.foreground then
+ local pts_fg=linear_orientation_inv(t.fg_orientation,t.width,t.height)
+ local pat = cairo_pattern_create_linear (pts_fg[1],pts_fg[2],pts_fg[3],pts_fg[4])
+ for i=1,#t.fg_colour,1 do
+ cairo_pattern_add_color_stop_rgba (pat, 1-t.fg_colour[i][1], rgb_to_r_g_b(t.fg_colour[i]))
+ end
+ cairo_set_source (cr, pat)
+ cairo_move_to(cr,t.beg*scale_x,0)
+ cairo_line_to(cr,t.beg*scale_x,t.values[t.beg+1]*scale_y)
+ for i=t.beg, t.nb_values-1 do
+ cairo_line_to(cr,i*scale_x,t.values[i+1]*scale_y)
+ end
+ cairo_line_to(cr,(t.nb_values-1)*scale_x,0)
+ cairo_close_path(cr)
+ cairo_fill(cr)
+ cairo_pattern_destroy(pat)
+ end
+ --graph_border
+ if t.fg_bd_size>0 then
+ local pts=linear_orientation_inv(t.fg_bd_orientation,t.width,t.height)
+ local pat = cairo_pattern_create_linear (pts[1],pts[2],pts[3],pts[4])
+ for i=1,#t.fg_bd_colour,1 do
+ cairo_pattern_add_color_stop_rgba (pat, 1-t.fg_bd_colour[i][1], rgb_to_r_g_b(t.fg_bd_colour[i]))
+ end
+ cairo_set_source (cr, pat)
+ cairo_move_to(cr,t.beg*scale_x,t.values[t.beg+1]*scale_y)
+ for i=t.beg, t.nb_values-1 do
+ cairo_line_to(cr,i*scale_x,t.values[i+1]*scale_y)
+ end
+ cairo_set_line_width(cr,t.fg_bd_size)
+ cairo_stroke(cr)
+ cairo_pattern_destroy(pat)
+ end
+ cairo_restore(cr)
+ --background border
+ if t.bg_bd_size>0 then
+ local pts=linear_orientation(t.bg_bd_orientation,t.width,t.height)
+ local pat = cairo_pattern_create_linear (pts[1],pts[2],pts[3],pts[4])
+ for i=1, #t.bg_bd_colour do
+ --print ("i",i,t.colour[i][1], rgb_to_r_g_b(t.colour[i]))
+ cairo_pattern_add_color_stop_rgba (pat, t.bg_bd_colour[i][1], rgb_to_r_g_b(t.bg_bd_colour[i]))
+ end
+ cairo_set_source (cr, pat)
+ cairo_rectangle(cr,0,0,t.width,t.height)
+ cairo_set_line_width(cr,t.bg_bd_size)
+ cairo_stroke(cr)
+ cairo_pattern_destroy(pat)
+ end
+
+ cairo_restore(cr)
+
+end
+
--- /dev/null
+-------------------------------------------------------------------------------\r
+-- This module implements a function that traverses all live objects.\r
+-- You can implement your own function to pass as a parameter of traverse\r
+-- and give you the information you want. As an example we have implemented\r
+-- countreferences and findallpaths\r
+--\r
+-- Alexandra Barros - 2006.03.15\r
+-------------------------------------------------------------------------------\r
+\r
+module("traverse", package.seeall)\r
+\r
+local List = {}\r
+\r
+function List.new ()\r
+ return {first = 0, last = -1}\r
+end\r
+\r
+function List.push (list, value)\r
+ local last = list.last + 1\r
+ list.last = last\r
+ list[last] = value\r
+end\r
+\r
+function List.pop (list) \r
+ local first = list.first\r
+ if first > list.last then error("list is empty") end\r
+ local value = list[first]\r
+ list[first] = nil \r
+ list.first = first + 1\r
+ return value\r
+end\r
+\r
+function List.isempty (list)\r
+ return list.first > list.last\r
+end\r
+\r
+-- Counts all references for a given object\r
+function countreferences(value)\r
+ local count = -1 \r
+ local f = function(from, to, how, v)\r
+ if to == value then \r
+ count = count + 1\r
+ end \r
+ end \r
+ traverse({edge=f}, {count, f})\r
+ return count\r
+end\r
+\r
+-- Main function\r
+-- 'funcs' is a table that contains a funcation for every lua type and also the\r
+-- function edge edge (traverseedge).\r
+function traverse(funcs, ignoreobjs)\r
+\r
+ -- The keys of the marked table are the objetcts (for example, table: 00442330).\r
+ -- The value of each key is true if the object has been found and false\r
+ -- otherwise.\r
+ local env = {marked = {}, list=List.new(), funcs=funcs}\r
+ \r
+ if ignoreobjs then\r
+ for i=1, #ignoreobjs do\r
+ env.marked[ignoreobjs[i]] = true\r
+ end\r
+ end\r
+ \r
+ env.marked["traverse"] = true\r
+ env.marked[traverse] = true\r
+ \r
+ -- marks and inserts on the list\r
+ edge(env, nil, "_G", "isname", nil)\r
+ edge(env, nil, _G, "value", "_G")\r
+\r
+ -- traverses the active thread\r
+ -- inserts the local variables\r
+ -- interates over the function on the stack, starting from the one that\r
+ -- called traverse\r
+ \r
+ for i=2, math.huge do\r
+ local info = debug.getinfo(i, "f") \r
+ if not info then break end \r
+ for j=1, math.huge do\r
+ local n, v = debug.getlocal(i, j)\r
+ if not n then break end\r
+ \r
+ edge(env, nil, n, "isname", nil)\r
+ edge(env, nil, v, "local", n)\r
+ end\r
+ end\r
+ \r
+ while not List.isempty(env.list) do \r
+ \r
+ local obj = List.pop(env.list)\r
+ local t = type(obj)\r
+ _M["traverse" .. t](env, obj)\r
+ \r
+ end \r
+ \r
+end\r
+\r
+function traversetable(env, obj)\r
+ \r
+ local f = env.funcs.table\r
+ if f then f(obj) end\r
+ \r
+ for key, value in pairs(obj) do \r
+ edge(env, obj, key, "key", nil)\r
+ edge(env, obj, value, "value", key)\r
+ end\r
+ \r
+ local mtable = debug.getmetatable(obj)\r
+ if mtable then edge(env, obj, mtable, "ismetatable", nil) end\r
+\r
+end\r
+ \r
+function traversestring(env, obj)\r
+ local f = env.funcs.string\r
+ if f then f(obj) end\r
+ \r
+end\r
+\r
+function traverseuserdata(env, obj)\r
+ local f = env.funcs.userdata\r
+ if f then f(obj) end\r
+ \r
+ local mtable = debug.getmetatable(obj)\r
+ if mtable then edge(env, obj, mtable, "ismetatable", nil) end\r
+ \r
+ local fenv = debug.getfenv(obj)\r
+ if fenv then edge(env, obj, fenv, "environment", nil) end\r
+ \r
+end\r
+\r
+function traversefunction(env, obj)\r
+ local f = env.funcs.func\r
+ if f then f(obj) end\r
+ \r
+ -- gets the upvalues\r
+ local i = 1 \r
+ while true do\r
+ local n, v = debug.getupvalue(obj, i)\r
+ if not n then break end -- when there is no upvalues\r
+ edge(env, obj, n, "isname", nil)\r
+ edge(env, obj, v, "upvalue", n)\r
+ i = i + 1\r
+ end\r
+ \r
+ local fenv = debug.getfenv(obj)\r
+ edge(env, obj, fenv, "environment", nil)\r
+ \r
+end\r
+ \r
+function traversethread(env, t)\r
+ local f = env.funcs.thread\r
+ if f then f(t) end\r
+ \r
+ for i=1, math.huge do\r
+ local info = debug.getinfo(t, i, "f") \r
+ if not info then break end \r
+ for j=1, math.huge do\r
+ local n, v = debug.getlocal(t, i , j)\r
+ if not n then break end\r
+ print(n, v)\r
+ \r
+ edge(env, nil, n, "isname", nil)\r
+ edge(env, nil, v, "local", n)\r
+ end\r
+ end\r
+ \r
+ local fenv = debug.getfenv(t)\r
+ edge(env, t, fenv, "environment", nil)\r
+ \r
+end\r
+\r
+\r
+-- 'how' is a string that identifies the content of 'to' and 'value':\r
+-- if 'how' is "key", then 'to' is a key and 'name' is nil.\r
+-- if 'how' is "value", then 'to' is an object and 'name' is the name of the\r
+-- key.\r
+function edge(env, from, to, how, name)\r
+ \r
+ local t = type(to) \r
+ \r
+ if to and (t~="boolean") and (t~="number") and (t~="new") then\r
+ -- If the destination object has not been found yet\r
+ if not env.marked[to] then \r
+ env.marked[to] = true\r
+ List.push(env.list, to) -- puts on the list to be traversed\r
+ end\r
+ \r
+ local f = env.funcs.edge\r
+ if f then f(from, to, how, name) end\r
+ \r
+ end \r
+end\r
+\r
+return _M;\r
--- /dev/null
+--\r
+-- Conky Lua scripting example\r
+--\r
+-- Copyright (c) 2009 Brenden Matthews, all rights reserved.\r
+--\r
+-- This program is free software: you can redistribute it and/or modify\r
+-- it under the terms of the GNU General Public License as published by\r
+-- the Free Software Foundation, either version 3 of the License, or\r
+-- (at your option) any later version.\r
+--\r
+\r
+function components_to_colour(r, g, b)\r
+ -- Take the RGB components r, g, b, and return an RGB integer\r
+ return ((math.floor(r + 0.5) * 0x10000) + (math.floor(g + 0.5) * 0x100) + math.floor(b + 0.5)) % 0xffffff -- no bit shifting operator in Lua afaik\r
+end\r
+\r
+function colour_to_components(colour)\r
+ -- Take the RGB components r, g, b, and return an RGB integer\r
+ return (colour / 0x10000) % 0x100, (colour / 0x100) % 0x100, colour % 0x100\r
+end\r
+\r
+function conky_top_colour(value, default_colour, lower_thresh, upper_thresh)\r
+ --[[\r
+ This function returns a colour based on a threshold, by adding more of\r
+ the red component and reducing the other components. ``value'' is the\r
+ value we're checking the thresholds against, ``default_colour'' is the\r
+ original colour (before adjusting), and the ``lower_thresh'' and\r
+ ``upper_thresh'' parameters are the low and high values for which we\r
+ start applying redness.\r
+ ]]\r
+ local r, g, b = colour_to_components(default_colour)\r
+ local colour = 0\r
+ if value ~= nil and (value - lower_thresh) > 0 then\r
+ if value > upper_thresh then value = upper_thresh end\r
+ local perc = (value - lower_thresh) / (upper_thresh - lower_thresh)\r
+ if perc > 1 then perc = 1 end\r
+ -- add some redness, depending on where ``value'' lies within the\r
+ -- threshhold range\r
+ r = r + perc * (0xff - r)\r
+ b = b - perc * b\r
+ g = g - perc * g\r
+ end\r
+ colour = components_to_colour(r, g, b)\r
+ return string.format("${color #%06x}", colour)\r
+end\r
+\r
+-- parses the output from top and calls the colour function\r
+function conky_top_cpu_colour(arg)\r
+ -- input is the top var number we want to use\r
+ local str = conky_parse(string.format('${top name %i}${top cpu %i}${top mem %i}', tonumber(arg), tonumber(arg), tonumber(arg)))\r
+ local cpu = tonumber(string.match(str, '(%d+%.%d+)'))\r
+ return conky_top_colour(cpu, 0xd3d3d3, 25, 70) .. str\r
+end\r
+\r
+function conky_top_mem_colour(arg)\r
+ -- input is the top var number we want to use\r
+ local str = conky_parse(string.format('${top_mem name %i}${top_mem mem_res %i} ${top_mem mem_vsize %i}', tonumber(arg), tonumber(arg), tonumber(arg)))\r
+ local mem = tonumber(string.match(str, '%w+%s+(%d+%.%d+)%w%s%s'))\r
+ -- tweak the last 3 parameters to your liking\r
+ -- my machine has ~8GiB of ram, so an upper thresh of 15% seemed appropriate\r
+ return conky_top_colour(mem, 0xd3d3d3, 10, 24) .. str\r
+end\r
+\r
+function conky_top_io_colour(arg)\r
+ -- input is the top var number we want to use\r
+ local str = conky_parse(string.format('${top_io name %i}${top_io io_read %i} ${top_io io_write %i} ${top_io io_perc %i}', tonumber(arg), tonumber(arg), tonumber(arg), tonumber(arg)))\r
+ local ioR,ioW = string.match(str, '%w+%s+(%d+%.*%d*%w)%s+(%d+%.*%d*%w)%s+')\r
+ local tot = conky_parse("${to_bytes "..ioR.."}") + conky_parse("${to_bytes "..ioW.."}") --these can be bytes or mb :(\r
+ -- tweak the last 3 parameters to your liking\r
+ -- my machine has ~8GiB of ram, so an upper thresh of 15% seemed appropriate\r
+ str = string.gsub(str," 0B", " 0.00B")\r
+ return conky_top_colour(tot, 0xd3d3d3, 100, 200) .. str\r
+end\r
+\r
+function colour_transition(start, stop, position)\r
+ --[[\r
+ Transition from one colour to another based on the value of\r
+ ``position'', which should be a number between 0 and 1.\r
+ ]]\r
+ local rs, gs, bs = colour_to_components(start) -- start components\r
+ local re, ge, be = colour_to_components(stop) -- end components\r
+ local function tr(s, e, p)\r
+ return e + (e - s) * p\r
+ end\r
+ local rr, gr, br = tr(rs, re, position), tr(gs, ge, position), tr(bs, be, position) -- result components\r
+ return components_to_colour(rr, gr, br)\r
+end\r
+\r
+function get_timezone_offset()\r
+ -- returns the number of seconds of timezone offset\r
+ local tz = tonumber(os.date('%z'))\r
+ local tzh = math.floor(tz / 100 + 0.5)\r
+ local tzm = math.abs(tz) % 100 / 60.\r
+ if tzh < 0 then tzm = -tzm end\r
+ return (tzh + tzm) * 3600\r
+end\r
+\r
+function julian_to_unix(J)\r
+ -- converts a julian date into unit time\r
+ return (J - 2440588) * 86400\r
+end\r
+\r
+function get_julian_now()\r
+ -- returns the current time in julian date format\r
+ local now = os.time()\r
+ return now / 86400. + 2440588\r
+end\r
+\r
+function calculate_sunrise_sunset(latitude, longitude)\r
+ --[[\r
+ This function returns the unix timestamps in the local time for sunrise and\r
+ sunset times, according to ``latitude'' and ``longitude''. For the\r
+ latitude, north is positive and south is negative. For the longitude, west\r
+ is negative, and east is positive. You can usually determine the lat/long\r
+ for your location from Wikipedia or using some mapping tool.\r
+\r
+ In my case (Calgary, AB) the lat/long are 51.045 and -114.057222\r
+\r
+ Reference: http://en.wikipedia.org/wiki/Sunrise_equation\r
+ ]]\r
+\r
+ -- Negate longitude, west is positive and east is negative\r
+ longitude = -longitude\r
+\r
+ -- Calculate current Julian Cycle\r
+ local n = math.floor(get_julian_now() - 2451545 - 0.0009 - longitude / 360 + 0.5)\r
+\r
+ -- Approximate Solar Noon\r
+ local Js = 2451545 + 0.0009 + longitude / 360 + n\r
+\r
+ -- Solar Mean Anomaly\r
+ local M = (357.5291 + 0.98560028 * (Js - 2451545)) % 360\r
+\r
+ -- Equation of Center\r
+ local C = (1.9148 * math.deg(math.sin(math.rad(M)))) + (0.0200 * math.deg(math.sin(math.rad(2 * M)))) + (0.0003 * math.deg(math.sin(math.rad(3 * M))))\r
+\r
+ -- Ecliptic Longitude\r
+ local lam = (M + 102.9372 + C + 180) % 360\r
+\r
+ -- Solar Transit\r
+ local Jt = Js + (0.0053 * math.deg(math.sin(math.rad(M)))) - (0.0069 * math.deg(math.sin(math.rad(2 * lam))))\r
+\r
+ -- Declination of the Sun\r
+ local delta = math.deg(math.asin(math.sin(math.rad(lam)) * math.sin(math.rad(23.45))))\r
+\r
+ -- Hour Angle\r
+ local w = math.deg(math.acos((math.sin(math.rad(-0.83)) - math.sin(math.rad(delta)) * math.sin(math.rad(latitude))) / (math.cos(math.rad(latitude)) * math.cos(math.rad(delta)))))\r
+\r
+ local J_set = 2451545 + 0.0009 + ((w + longitude)/360 + n + (0.0053 * math.deg(math.sin(math.rad(M)))) - (0.0069 * math.deg(math.sin(math.rad(2 * lam)))))\r
+ local J_rise = Jt - (J_set - Jt)\r
+\r
+\r
+ local rising_t, setting_t = julian_to_unix(J_rise), julian_to_unix(J_set)\r
+\r
+ -- apply timezone offset\r
+ local tz_offset = get_timezone_offset()\r
+ rising_t = rising_t + tz_offset\r
+ setting_t = setting_t + tz_offset\r
+\r
+ return rising_t, setting_t\r
+end\r
+\r
+local last_sunrise_set_check = 0\r
+local sunrise, sunset = 0\r
+\r
+function conky_datey(latitude, longitude, change)\r
+ --[[\r
+ Returns a colour at or between day_sky and night_sky (see below) depending on the\r
+ time of day. You must provide the ``latitude'' and ``longitude''\r
+ parameters for your location (see the comments for\r
+ calculate_sunrise_sunset() above for more info). The ``change'' parameter\r
+ is the number of hours we want to start and have a transition, so a value\r
+ of 1 will mean the transition starts 30 minutes before, and ends 30 minutes\r
+ after.\r
+ ]]\r
+ local function to_hours(t)\r
+ return tonumber(os.date('%k', t)) + (tonumber(os.date('%M', t)) / 60) + (tonumber(os.date('%S', t)) / 3600)\r
+ end\r
+ if last_sunrise_set_check < os.time() - 86400 then\r
+ sunrise, sunset = calculate_sunrise_sunset(tonumber(latitude), tonumber(longitude))\r
+ -- convert unix times into hours\r
+ sunrise, sunset = to_hours(sunrise), to_hours(sunset)\r
+ end\r
+ local day_sky = 0x6698FF -- colour to use during daytime\r
+ local night_sky = 0x342D7E -- colour to use during nighttime\r
+ local hour = to_hours(os.time())\r
+ if hour > sunrise + change / 2 and hour < sunset - change / 2 then\r
+ -- midday\r
+ sky = day_sky\r
+ elseif hour > sunset + change / 2 or hour < sunrise - change / 2 then\r
+ -- midnight\r
+ sky = night_sky\r
+ elseif hour > sunset - change / 2 then\r
+ -- sunset time\r
+ sky = colour_transition(day_sky, night_sky, (hour - sunset - change / 2) / change)\r
+ elseif hour < sunrise + change / 2 then\r
+ -- sunrise time\r
+ sky = colour_transition(night_sky, day_sky, (hour - sunrise - change / 2) / change)\r
+ end\r
+ return string.format('${color #%6x}', sky)\r
+end\r
+\r
+require 'imlib2'\r
+\r
--- /dev/null
+--[[PIE CHART WIDGET BY WLOURF v1.21 26 june 2010
+
+This widget draw a pie chart or a ring in a conky window.
+More info on the parameters with pictures on this page :
+http://u-scripts.blogspot.com/2010/04/pie-chart-widget.html
+
+Parameters are :
+tableV -- table of labels and values {{label,conky_variable,conky_argument,convert to Go-Mo-Ko units (true/false) or unit}, ...}
+ -- this table is mandatory, others parameters are optionals
+ -- example :
+ tableV={
+ {"cpu 0","cpu","cpu0",100,"%"},
+ {"cpu 1","cpu","cpu1",100,"%"},
+ },
+ -- to know disk space, use this line :
+ tableV=read_df(true,true),
+
+xc -- x center of the pie, default = conky_window.width/2
+yc, -- y center of the pie, default = conky_window.height/2
+radius_int -- internal radius in pixel, default = conky_window.width/6
+radius_ext -- external radius in pixel, default = conky_window.width/4
+first_angle -- first angle of the pie (in degrees), default=0
+last_angle -- last angle of the pie (in degrees), default=360
+type_arc, -- fill the arc in a linear way (ring) or radial way (pie), values l or r, default=l
+inverse_l_arc -- inverse arc for rings (true/false), default=false
+proportional -- display proportional sectors (true/false); default =false
+gradient_effect -- gradient effect (true/false), default=true
+line_length -- length for horizontal line (from radius_ext to end of line), default=radius_ext
+line_thickness -- thickness of line, default=1
+line_space -- vertical space between two lines, default=10 pixels
+extend_line -- grow up the line (true/false) if length of text> line_length, default=true
+nb_decimals -- number of decimals for numbers, default=1
+show_text -- display text (true/false), default=true
+font_name -- font, default "Droid Sans Mono"
+font_size -- font size, default=12
+font_color -- font color (for gradient) or nil (for constant color), default = nil
+font_alpha -- font alpha, default=1
+txt_offset -- space between text and line, default=1
+txt_format -- string for formatting text, possibles values are : default = "&l : &v"
+ -- &l for label
+ -- &o for occupied percentage
+ -- &f for free percentage
+ -- &v for value
+ -- &n for free value (non-occupied)
+ -- &m for max value
+ -- &p for percentage value of full graph
+tablebg -- table of tables of colours for background {colors,alpha}
+tablefg -- table of tables of colours for foreground {colors,alpha}
+
+
+v1.0 10/04/2010 original release
+v1.1 15/05/2010 the parameters are in a table (pie_settings), only the values in pie_settings.tableV are mandatory
+ added an option to draw values like a ring (type_arc="l")
+v1.2 26/05/2010 add inverse_l parameter (for type_arc="l")
+ bug fix : line_length problem
+ read_df function improved
+v1.21 26/06/2010 rename some parameters and write more infos
+]]
+
+
+require 'cairo'
+
+
+--main function
+function conky_main_pie()
+ if conky_window==nil then return end
+
+
+-- ------------------PARAMETERS TO SET-----------------------
+ --theses parameters are called many times so I put them into variables
+ local font_name,font_size="Droid Sans Mono",14
+ local col0,col1,col2=0xFFFFCC,0xCCFF99,0x99FF00
+ local colbg=0x99CCFF
+
+ --for the clock
+ local temp = os.date("*t")
+ local hour=temp.hour
+ if hour>12 then hour=hour-12 end
+ local hpc,mpc,spc=hour/12,temp.min/60,temp.sec/60
+
+
+ pie_settings= {
+
+ {--CIRCLE 4 : DISK SPACE
+ tableV=read_df(true,true),
+ xc=500,
+ yc=150 ,
+ int_radius=30,
+ radius=45,
+ type_arc="r",
+ proportional=true,
+ first_angle=-90,
+ last_angle=270,
+ gradient_effect=true,
+ show_text=true,
+ line_lgth=100,
+ line_space=19,
+ txt_format="&l free &n",
+ font_color=colbg,
+ tablebg={
+ {colbg,0.5},
+ },
+ tablefg={
+ {col0,1},
+ {col1,1},
+ {col2,1},
+ },
+ },
+
+
+ {--CIRCLE 1 : ARCS 1 & 2 INTERNET SPEED
+ tableV={
+ {"dl","downspeedf","eth1",1000,"kb/s"},
+ {"ul","upspeedf","eth1",100,"kb/s"},
+ },
+ xc=300,
+ yc=200,
+ int_radius=30,
+ radius=45,
+ first_angle=-30,
+ last_angle=210,
+ type_arc="r",
+ --line_lgth=150,
+ line_width=0,
+ show_text=false,
+ font_color=colbg,
+ tablebg={
+ {colbg,0.5},
+ },
+ tablefg={
+ {col0,1},
+ {col1,1},
+ },
+ },
+
+
+ {--CIRCLE 2 : ARC 1 CPU 0
+ tableV={
+ {"cpu 0","cpu","cpu 0",100,"%"},
+ --{"cpu 1","cpu","cpu 1",100,"%"},
+ },
+ xc=300,
+ yc=350,
+ int_radius=30,
+ radius=45,
+ first_angle=-30,
+ last_angle=210,
+ type_arc="l",
+ show_text=false,
+ tablebg={
+ {colbg,0.5},
+ },
+ tablefg={
+ {col0,1},
+ },
+ },
+
+-- {--CIRCLE 2 : ARC 2 CPU 1
+-- tableV={
+-- --{"cpu 0","cpu","cpu 0",100,"%"},
+-- {"cpu 1","cpu","cpu 1",100,"%"},
+-- },
+-- xc=200,
+-- yc=350,
+-- int_radius=30,
+-- radius=45,
+-- first_angle=90,
+-- last_angle=220,
+-- type_arc="l",
+-- inverse_l_arc=true,
+-- show_text=false,
+-- tablebg={
+-- {colbg,0.5},
+-- },
+-- tablefg={
+-- {col0,1},
+-- },
+-- },
+
+
+
+
+
+ {--CIRCLE 3 : MEMORY : ram
+ tableV={
+ {"mem","memperc","",100,"%"},
+ },
+ xc=400,
+ yc=370,
+ int_radius=30,
+ radius=45,
+ first_angle=-30,
+ last_angle=220,
+ type_arc="l",
+ inverse_l_arc=false,
+ proportional=false,
+ gradient_effect=true,
+ nb_decimals=0,
+ show_text=false,
+ tablebg={
+ {colbg,0.5},
+ },
+ tablefg={
+ {col0,1},
+ },
+ },
+
+
+ }
+-------------------END OF PARAMETERS ---------------
+
+ local w=conky_window.width
+ local h=conky_window.height
+ local cs=cairo_xlib_surface_create(conky_window.display, conky_window.drawable, conky_window.visual, w, h)
+ cr=cairo_create(cs)
+
+ if tonumber(conky_parse('${updates}'))>5 then
+ for i in pairs(pie_settings) do
+ draw_pie(pie_settings[i])
+ end
+ end
+ cairo_surface_destroy(cs)
+ cairo_destroy(cr)
+end
+
+
+
+function string:split(delimiter)
+--source for the split function : http://www.wellho.net/resources/ex.php4?item=u108/split
+ local result = { }
+ local from = 1
+ local delim_from, delim_to = string.find( self, delimiter, from )
+ while delim_from do
+ table.insert( result, string.sub( self, from , delim_from-1 ) )
+ from = delim_to + 1
+ delim_from, delim_to = string.find( self, delimiter, from )
+ end
+ table.insert( result, string.sub( self, from ) )
+ return result
+end
+
+
+function rgb_to_r_g_b(colour, alpha)
+ return ((colour / 0x10000) % 0x100) / 255., ((colour / 0x100) % 0x100) / 255., (colour % 0x100) / 255., alpha
+end
+
+function round(num, idp)
+ local mult = 10^(idp or 0)
+ return math.floor(num * mult + 0.5) / mult
+end
+
+function size_to_text(size,nb_dec)
+ local txt_v
+ if nb_dec<0 then nb_dec=0 end
+ size = tonumber(size)
+ if size>1024*1024*1024 then
+ txt_v=string.format("%."..nb_dec.."f G",size/1024/1024/1024)
+ elseif size>1024*1024 then
+ txt_v=string.format("%."..nb_dec.."f M",size/1024/1024)
+ elseif size>1024 then
+ txt_v=string.format("%."..nb_dec.."f K",size/1024)
+ else
+ txt_v=string.format("%."..nb_dec.."f B",size)
+ end
+ return txt_v
+end
+
+function text_to_bytes(txt_in)
+ local txt_modifier
+ local num_bytes
+ txt_modifier = string.match(txt_in,"%d(%a)")
+ num_bytes = string.gsub(txt_in,"%d(%a)","")
+ if txt_modifier == "G" then
+ num_bytes = num_bytes*1024*1024*1024
+ elseif txt_modifier == "M" then
+ num_bytes = num_bytes*1024*1024
+ elseif txt_modifier == "K" then
+ num_bytes = num_bytes*1024
+ elseif txt_modifier == "B" then
+ num_bytes = num_bytes
+ end
+ return num_bytes
+end
+
+
+
+function read_df(show_media,sort_table)
+ --read output of command df and return arrays of value for files systems
+ --reurn array of table {file syst, "", occupied space , total space , convert to G, M, K ...}
+
+ local f = io.popen("df")
+
+ local results={}
+ table.insert(results,{"/home/user/MyDocs","",text_to_bytes(conky_parse("${fs_used /home/user/MyDocs}")),text_to_bytes(conky_parse("${fs_size /home/user/MyDocs}")),true})
+ table.insert(results,{"/home","",text_to_bytes(conky_parse("${fs_used /home}")),text_to_bytes(conky_parse("${fs_size /home}")),true})
+ table.insert(results,{"rootfs","",text_to_bytes(conky_parse("${fs_used /}")),text_to_bytes(conky_parse("${fs_size /}")),true})
+ table.insert(results,{"SD","",text_to_bytes(conky_parse("${fs_used /media/mmc1}")),text_to_bytes(conky_parse("${fs_size /media/mmc1}")),true})
+ --table.insert(results,{"/home/user/MyDocs2","","30","50",true})
+ --table.insert(results,{text_to_bytes(conky_parse("${fs_used /home/user/MyDocs}")),"","10","50",true})
+-- while true do
+-- local line = f:read("*l")
+-- if line == nil then break end
+-- while string.match(line," ") do
+-- line=string.gsub(line," "," ")
+-- end
+-- local arr_l=string.split(line," ")
+-- local match = string.match(arr_l[1],"/")
+--
+-- if string.match(arr_l[1],"/") then
+-- if not show_media then arr_l[6]=string.gsub(arr_l[6],"/media/","",1) end
+-- if string.match(arr_l[1],"opt/") then break end
+-- table.insert(results,{arr_l[6],"",(arr_l[2]-arr_l[4])*1024,arr_l[2]*1024,true})
+-- end
+-- end
+--
+-- f:close()
+--
+-- if sort_table then
+-- --how to sort table into table?
+-- local flagS=true
+-- while flagS do
+-- for k=2, #results do
+-- flagS=false
+-- if tonumber(results[1][3])>tonumber(results[2][3]) then
+-- local tmpV = results[1]
+-- results[1] = results[2]
+-- results[2] = tmpV
+-- flagS=true
+-- end
+-- if tonumber(results[k][3])<tonumber(results[k-1][3]) then
+-- local tmpV = results[k-1]
+-- results[k-1] = results[k]
+-- results[k] = tmpV
+-- flagS=true
+-- end
+-- end
+-- end
+-- end
+
+ return results --array {file syst, occupied space , total space }
+end
+
+
+function draw_pie(t)
+
+ if t.tableV==nil then
+ print ("No input values ...")
+ return
+ else
+ tableV=t.tableV
+ end
+
+ if t.xc==nil then t.xc=conky_window.width/2 end
+ if t.yc==nil then t.yc=conky_window.height/2 end
+ if t.int_radius ==nil then t.int_radius =conky_window.width/6 end
+ if t.radius ==nil then t.radius =conky_window.width/4 end
+ if t.first_angle==nil then t.first_angle =0 end
+ if t.last_angle==nil then t.last_angle=360 end
+ if t.proportional==nil then t.proportional=false end
+ if t.tablebg==nil then t.tablebg={{0xFFFFFF,0.5},{0xFFFFFF,0.5}} end
+ if t.tablefg==nil then t.tablefg={{0xFF0000,1},{0x00FF00,1}} end
+ if t.gradient_effect==nil then t.gradient_effect=true end
+ if t.show_text==nil then t.show_text=true end
+ if t.line_lgth==nil then t.line_lgth=t.int_radius end
+ if t.line_space==nil then t.line_space=10 end
+ if t.line_width==nil then t.line_width=1 end
+ if t.extend_line==nil then t.extend_line=true end
+ if t.txt_font==nil then t.txt_font="Droid Sans Mono" end
+ if t.font_size==nil then t.font_size=12 end
+ --if t.font_color==nil then t.font_color=0xFFFFFF end
+ if t.font_alpha==nil then t.font_alpha = 1 end
+ if t.txt_offset==nil then t.txt_offset = 1 end
+ if t.txt_format==nil then t.txt_format = "&l : &v" end
+ if t.nb_decimals==nil then t.nb_decimals=1 end
+ if t.type_arc==nil then t.type_arc="l" end
+ if t.inverse_l_arc==nil then t.inverse_l_arc=false end
+
+
+ local function draw_sector(tablecolor,colorindex,pc,lastAngle,angle,radius,int_radius,gradient_effect,type_arc,inverse_l_arc)
+ --draw a portion of arc
+ radiuspc=(radius-int_radius)*pc+int_radius
+ angle0=lastAngle
+ val=1
+ if type_arc=="l" then
+ val=pc;radiuspc=radius
+ end
+ angle1=angle*val
+
+ if type_arc=="l" and inverse_l_arc then
+
+ cairo_save(cr)
+
+ cairo_rotate(cr,angle0+angle)
+
+ if gradient_effect then
+ local pat = cairo_pattern_create_radial (0,0, int_radius, 0,0,radius)
+ cairo_pattern_add_color_stop_rgba (pat, 0, rgb_to_r_g_b(tablecolor[colorindex][1],0))
+ cairo_pattern_add_color_stop_rgba (pat, 0.5, rgb_to_r_g_b(tablecolor[colorindex][1],tablecolor[colorindex][2]))
+ cairo_pattern_add_color_stop_rgba (pat, 1, rgb_to_r_g_b(tablecolor[colorindex][1],0))
+ cairo_set_source (cr, pat)
+ cairo_pattern_destroy(pat)
+ else
+ cairo_set_source_rgba(cr,rgb_to_r_g_b(tablecolor[colorindex][1],tablecolor[colorindex][2]))
+ end
+ cairo_move_to(cr,0,-int_radius)
+ cairo_line_to(cr,0,-radiuspc)
+ cairo_rotate(cr,-math.pi/2)
+
+ cairo_arc_negative(cr,0,0,radiuspc,0,-angle1)
+ cairo_rotate(cr,-math.pi/2-angle1)
+ cairo_line_to(cr,0,int_radius)
+ cairo_rotate(cr,math.pi/2)
+ cairo_arc(cr,0,0,int_radius,0,angle1)
+ cairo_close_path (cr);
+ cairo_fill(cr)
+
+ cairo_restore(cr)
+ else
+
+ cairo_save(cr)
+
+ cairo_rotate(cr,angle0)
+
+ if gradient_effect then
+ local pat = cairo_pattern_create_radial (0,0, int_radius, 0,0,radius)
+ cairo_pattern_add_color_stop_rgba (pat, 0, rgb_to_r_g_b(tablecolor[colorindex][1],0))
+ cairo_pattern_add_color_stop_rgba (pat, 0.5, rgb_to_r_g_b(tablecolor[colorindex][1],tablecolor[colorindex][2]))
+ cairo_pattern_add_color_stop_rgba (pat, 1, rgb_to_r_g_b(tablecolor[colorindex][1],0))
+ cairo_set_source (cr, pat)
+ cairo_pattern_destroy(pat)
+ else
+ cairo_set_source_rgba(cr,rgb_to_r_g_b(tablecolor[colorindex][1],tablecolor[colorindex][2]))
+ end
+ cairo_move_to(cr,0,-int_radius)
+ cairo_line_to(cr,0,-radiuspc)
+ cairo_rotate(cr,-math.pi/2)
+
+ cairo_arc(cr,0,0,radiuspc,0,angle1)
+ cairo_rotate(cr,angle1-math.pi/2)
+ cairo_line_to(cr,0,int_radius)
+ cairo_rotate(cr,math.pi/2)
+ cairo_arc_negative(cr,0,0,int_radius,0,-angle1)
+ cairo_close_path (cr);
+ cairo_fill(cr)
+
+ cairo_restore(cr)
+ end
+
+
+ end
+
+ function draw_lines(idx,nbArcs,angle,table_colors,idx_color,adjust,line_lgth,length_txt,txt_offset,radius,line_width,line_space,font_color,font_alpha)
+ --draw lines
+
+ local x0=radiuspc*math.sin(lastAngle+angle/2)
+ local y0=-radiuspc*math.cos(lastAngle+angle/2)
+ local x1=1.2*radius*math.sin(lastAngle+angle/2)
+ local y1=-1.2*radius*math.cos(lastAngle+angle/2)
+
+ local x2=line_lgth
+ local y2=y1
+ local x3,y3=nil,nil
+ if x0<=0 then
+ x2=-x2
+ end
+
+ if adjust then
+ if x0>0 and x2-x1<length_txt then x2=x1+length_txt end
+ if x0<=0 and x1-x2<length_txt then x2=x1-length_txt end
+ end
+
+ if idx>1 then
+ local dY = math.abs(y2-lastPt2[2])
+ if dY < line_space and lastPt2[1]*x1>0 then
+ if x0>0 then
+ y2 = line_space+lastPt2[2]
+ else
+ y2 = -line_space+lastPt2[2]
+ end
+ if (y2>y1 and x0>0) or (y2<y1 and x0<0 ) then
+ --x3 is for vertical segment if needed
+ x3,y3=x2,y2
+ x2=x1
+ if x3>0 then x3=x3+txt_offset end
+ else
+ Z=intercept({x0,y0},{x1,y1},{0,y2},{1,y2})
+ x1,y1=Z[1],Z[2]
+ end
+ end
+ else
+ --remind x2,y2 of first value
+ x2first,y2first = x2,y2
+ end
+
+ if font_color==nil then
+ cairo_set_source_rgba(cr,rgb_to_r_g_b(table_colors[idx_color][1],table_colors[idx_color][2]))
+ else
+ local pat = cairo_pattern_create_linear (x2,y2, x0,y0)
+ cairo_pattern_add_color_stop_rgba (pat, 0, rgb_to_r_g_b(font_color,font_alpha))
+ cairo_pattern_add_color_stop_rgba (pat, 1, rgb_to_r_g_b(table_colors[idx_color][1],table_colors[idx_color][2]))
+ cairo_set_source (cr, pat)
+ cairo_pattern_destroy(pat)
+ end
+
+
+ cairo_move_to(cr,x0,y0)
+ cairo_line_to(cr,x1,y1)
+ cairo_line_to(cr,x2,y2)
+ if x3~=nil then
+ cairo_line_to(cr,x3,y3)
+ x2,y2=x3,y3
+ end
+ cairo_set_line_width(cr,line_width)
+ cairo_stroke(cr)
+ --lastAngle=lastAngle+angle
+ return {x2,y2}
+ end
+
+ function intercept(p11,p12,p21,p22)
+ --calculate interscetion of two lines and return coordinates
+ a1=(p12[2]-p11[2])/(p12[1]-p11[1])
+
+ a2=(p22[2]-p21[2])/(p22[1]-p21[1])
+
+ b1=p11[2]-a1*p11[1]
+
+ b2=p21[2]-a2*p21[1]
+
+ X=(b2-b1)/(a1-a2)
+
+ Y=a1*X+b1
+ return {X,Y}
+ end
+
+ --some checks
+ if t.first_angle>=t.last_angle then
+ local tmp_angle=t.last_angle
+ --t.last_angle=t.first_angle
+ --t.first_angle=tmp_angle
+ print ("inversed angles")
+ end
+
+ if t.last_angle-t.first_angle>360 and t.first_angle>0 then
+ t.last_angle=360+t.first_angle
+ print ("reduce angles")
+ end
+
+ if t.last_angle+t.first_angle>360 and t.first_angle<=0 then
+ t.last_angle=360+t.first_angle
+ print ("reduce angles")
+ end
+
+ if t.int_radius<0 then t.int_radius =0 end
+ if t.int_radius>t.radius then
+ local tmp_radius=t.radius
+ t.radius=t.int_radius
+ t.int_radius=tmp_radius
+ print ("inversed angles")
+ end
+ if t.int_radius==t.radius then
+ t.int_radius=0
+ print ("int radius set to 0")
+ end
+ --end of checks
+
+ cairo_save(cr)
+ cairo_translate(cr,t.xc,t.yc)
+ cairo_set_line_join (cr, CAIRO_LINE_JOIN_ROUND)
+ cairo_set_line_cap (cr, CAIRO_LINE_CAP_ROUND)
+
+ local nbArcs=#tableV
+ local anglefull= (t.last_angle-t.first_angle)*math.pi/180
+ local fullsize = 0
+ for i= 1,nbArcs do
+ fullsize=fullsize+tableV[i][4]
+ end
+
+ local cb,cf,angle=0,0,anglefull/nbArcs
+ lastAngle=t.first_angle*math.pi/180
+ lastPt2={nil,nil}
+
+ for i =1, nbArcs do
+ if t.proportional then
+ angle=tableV[i][4]/fullsize*anglefull
+ end
+ --set colours
+ cb,cf=cb+1,cf+1
+ if cb>#t.tablebg then cb=1 end
+ if cf>#t.tablefg then cf=1 end
+
+ if tableV[i][2]~="" then
+ str=string.format('${%s %s}',tableV[i][2],tableV[i][3])
+ else
+ str = tableV[i][3]
+ end
+ str=conky_parse(str)
+ value=tonumber(str)
+ if value==nil then value=0 end
+
+ --draw sectors
+ draw_sector(t.tablebg,cb,1,lastAngle,angle,t.radius,t.int_radius,t.gradient_effect,t.type_arc,t.inverse_l_arc)
+ --print (t.tablefg,cf,tableV[i][2],tableV[i][3],lastAngle,angle,t.radius,t.int_radius)
+ --print (cf,tableV[i],tableV[i][2],tableV[i][3])
+ draw_sector(t.tablefg,cf,value/tableV[i][4],lastAngle,angle,t.radius,t.int_radius,t.gradient_effect,t.type_arc,t.inverse_l_arc)
+
+ if t.show_text then
+ --draw text
+ local txt_l = tableV[i][1]
+ local txt_opc = round(100*value/tableV[i][4],t.nb_decimals).."%%"
+ local txt_fpc = round(100*(tableV[i][4]-value/tableV[i][4]),t.nb_decimals).."%%"
+ local txt_ov,txt_fv,txt_max
+ if tableV[i][5]==true then
+ txt_ov = size_to_text(value,t.nb_decimals)
+ txt_fv = size_to_text(tableV[i][4]-value,t.nb_decimals)
+ txt_max = size_to_text(tableV[i][4],t.nb_decimals)
+ else
+ if tableV[i][5]=="%" then tableV[i][5]="%%" end
+ txt_ov=string.format("%."..t.nb_decimals.."f ",value)..tableV[i][5]
+ txt_fv=string.format("%."..t.nb_decimals.."f",tableV[i][4]-value)..tableV[i][5]
+ txt_max=string.format("%."..t.nb_decimals.."f",tableV[i][4])..tableV[i][5]
+ end
+ txt_pc = string.format("%."..t.nb_decimals.."f",100*tableV[i][4]/fullsize).."%%"
+ local txt_out = t.txt_format
+ txt_out = string.gsub(txt_out,"&l",txt_l) --label
+ txt_out = string.gsub(txt_out,"&o",txt_opc)--occ. %
+ txt_out = string.gsub(txt_out,"&f",txt_fpc)--free %
+ txt_out = string.gsub(txt_out,"&v",txt_ov) --occ. value
+ txt_out = string.gsub(txt_out,"&n",txt_fv) --free value
+ txt_out = string.gsub(txt_out,"&m",txt_max)--max
+ txt_out = string.gsub(txt_out,"&p",txt_pc)--percent
+
+ local te=cairo_text_extents_t:create()
+ cairo_set_font_size(cr,t.font_size)
+ cairo_select_font_face(cr, t.txt_font, CAIRO_FONT_SLANT_NORMAL, CAIRO_FONT_WEIGHT_NORMAL)
+ cairo_text_extents (cr,txt_out,te)
+
+ --draw lines
+ lastPt2=draw_lines(i,nbArcs,angle,t.tablefg,cf,t.extend_line,t.line_lgth+t.radius,
+ te.width + te.x_bearing,t.txt_offset,t.radius,t.line_width,t.line_space,t.font_color,t.font_alpha)
+
+ local xA=lastPt2[1]
+ local yA=lastPt2[2]-t.line_width-t.txt_offset
+ if xA>0 then xA = xA-(te.width + te.x_bearing) end
+ cairo_move_to(cr,xA,yA)
+ cairo_show_text(cr,txt_out)
+ end
+
+ lastAngle=lastAngle+angle
+ end
+ cairo_restore(cr)
+end
+
+
+--[[END OF PIE CHART WIDGET]]
--- /dev/null
+--
+-- strict.lua
+-- checks uses of undeclared global variables
+-- All global variables must be 'declared' through a regular assignment
+-- (even assigning nil will do) in a main chunk before being used
+-- anywhere or assigned to inside a function.
+--
+-- From Lua distribution (etc/strict.lua)
+--
+
+local getinfo, error, rawset, rawget = debug.getinfo, error, rawset, rawget
+
+local mt = getmetatable(_G)
+if mt == nil then
+ mt = {}
+ setmetatable(_G, mt)
+end
+
+mt.__declared = {}
+
+local function what ()
+ local d = getinfo(3, "S")
+ return d and d.what or "C"
+end
+
+mt.__newindex = function (t, n, v)
+ if not mt.__declared[n] then
+ local w = what()
+ if w ~= "main" and w ~= "C" then
+ print("assign to undeclared variable '"..n.."'")
+ end
+ mt.__declared[n] = true
+ end
+ rawset(t, n, v)
+end
+
+mt.__index = function (t, n)
+ if not mt.__declared[n] and what() ~= "C" then
+ print("variable '"..n.."' is not declared")
+ end
+ return rawget(t, n)
+end
--- /dev/null
+--[[\r
+Ring Meters by londonali1010 (2009)\r
+\r
+This script draws percentage meters as rings. It is fully customisable; all options are described in the script.\r
+\r
+IMPORTANT: if you are using the 'cpu' function, it will cause a segmentation fault if it tries to draw a ring straight away. The if statement on line 145 uses a delay to make sure that this doesn't happen. It calculates the length of the delay by the number of updates since Conky started. Generally, a value of 5s is long enough, so if you update Conky every 1s, use update_num > 5 in that if statement (the default). If you only update Conky every 2s, you should change it to update_num > 3; conversely if you update Conky every 0.5s, you should use update_num > 10. ALSO, if you change your Conky, is it best to use "killall conky; conky" to update it, otherwise the update_num will not be reset and you will get an error.\r
+\r
+To call this script in Conky, use the following (assuming that you save this script to ~/scripts/rings.lua):\r
+ lua_load ~/scripts/rings-v1.2.1.lua\r
+ lua_draw_hook_pre ring_stats\r
+\r
+Changelog:\r
++ v1.2.1 -- Fixed minor bug that caused script to crash if conky_parse() returns a nil value (20.10.2009)\r
++ v1.2 -- Added option for the ending angle of the rings (07.10.2009)\r
++ v1.1 -- Added options for the starting angle of the rings, and added the "max" variable, to allow for variables that output a numerical value rather than a percentage (29.09.2009)\r
++ v1.0 -- Original release (28.09.2009)\r
+]]\r
+\r
+settings_table = {\r
+ {\r
+ -- Edit this table to customise your rings.\r
+ -- You can create more rings simply by adding more elements to settings_table.\r
+ -- "name" is the type of stat to display; you can choose from 'cpu', 'memperc', 'fs_used_perc', 'battery_used_perc'.\r
+ name='time',\r
+ -- "arg" is the argument to the stat type, e.g. if in Conky you would write ${cpu cpu0}, 'cpu0' would be the argument. If you would not use an argument in the Conky variable, use ''.\r
+ arg='%I.%M',\r
+ -- "max" is the maximum value of the ring. If the Conky variable outputs a percentage, use 100.\r
+ max=12,\r
+ -- "bg_colour" is the colour of the base ring.\r
+ bg_colour=0xffffff,\r
+ -- "bg_alpha" is the alpha value of the base ring.\r
+ bg_alpha=0.1,\r
+ -- "fg_colour" is the colour of the indicator part of the ring.\r
+ fg_colour=0xffffff,\r
+ -- "fg_alpha" is the alpha value of the indicator part of the ring.\r
+ fg_alpha=0.2,\r
+ -- "x" and "y" are the x and y coordinates of the centre of the ring, relative to the top left corner of the Conky window.\r
+ x=165, y=170,\r
+ -- "radius" is the radius of the ring.\r
+ radius=50,\r
+ -- "thickness" is the thickness of the ring, centred around the radius.\r
+ thickness=5,\r
+ -- "start_angle" is the starting angle of the ring, in degrees, clockwise from top. Value can be either positive or negative.\r
+ start_angle=0,\r
+ -- "end_angle" is the ending angle of the ring, in degrees, clockwise from top. Value can be either positive or negative, but must be larger (e.g. more clockwise) than start_angle.\r
+ end_angle=360\r
+ },\r
+ {\r
+ name='time',\r
+ arg='%M.%S',\r
+ max=60,\r
+ bg_colour=0xffffff,\r
+ bg_alpha=0.1,\r
+ fg_colour=0xffffff,\r
+ fg_alpha=0.4,\r
+ x=165, y=170,\r
+ radius=56,\r
+ thickness=5,\r
+ start_angle=0,\r
+ end_angle=360\r
+ },\r
+ {\r
+ name='time',\r
+ arg='%S',\r
+ max=60,\r
+ bg_colour=0xffffff,\r
+ bg_alpha=0.1,\r
+ fg_colour=0xffffff,\r
+ fg_alpha=0.6,\r
+ x=165, y=170,\r
+ radius=62,\r
+ thickness=5,\r
+ start_angle=0,\r
+ end_angle=360\r
+ },\r
+ {\r
+ name='cpu',\r
+ arg='cpu0',\r
+ max=100,\r
+ bg_colour=0xffffff,\r
+ bg_alpha=0.1,\r
+ fg_colour=0xffffff,\r
+ fg_alpha=0.4,\r
+ x=165, y=170,\r
+ radius=84.5,\r
+ thickness=8,\r
+ start_angle=60,\r
+ end_angle=120\r
+ },\r
+ {\r
+ name='battery_percent',\r
+ arg='BAT1',\r
+ max=100,\r
+ bg_colour=0xffffff,\r
+ bg_alpha=0.1,\r
+ fg_colour=0xffffff,\r
+ fg_alpha=0.6,\r
+ x=165, y=170,\r
+ radius=72,\r
+ thickness=11,\r
+ start_angle=122,\r
+ end_angle=210\r
+ },\r
+ {\r
+ name='memperc',\r
+ arg='',\r
+ max=100,\r
+ bg_colour=0xffffff,\r
+ bg_alpha=0.1,\r
+ fg_colour=0xffffff,\r
+ fg_alpha=0.8,\r
+ x=165, y=170,\r
+ radius=83.5,\r
+ thickness=8,\r
+ start_angle=122,\r
+ end_angle=210\r
+ },\r
+ {\r
+ name='time',\r
+ arg='%d',\r
+ max=31,\r
+ bg_colour=0xffffff,\r
+ bg_alpha=0.1,\r
+ fg_colour=0xffffff,\r
+ fg_alpha=0.8,\r
+ x=165, y=170,\r
+ radius=70,\r
+ thickness=5,\r
+ start_angle=212,\r
+ end_angle=360\r
+ },\r
+ {\r
+ name='time',\r
+ arg='%m',\r
+ max=12,\r
+ bg_colour=0xffffff,\r
+ bg_alpha=0.1,\r
+ fg_colour=0xffffff,\r
+ fg_alpha=0.8,\r
+ x=165, y=170,\r
+ radius=76,\r
+ thickness=5,\r
+ start_angle=212,\r
+ end_angle=360\r
+ },\r
+ {\r
+ name='fs_used_perc',\r
+ arg='/',\r
+ max=150,\r
+ bg_colour=0xffffff,\r
+ bg_alpha=0.2,\r
+ fg_colour=0xffffff,\r
+ fg_alpha=0.3,\r
+ x=165, y=170,\r
+ radius=108.5,\r
+ thickness=3,\r
+ start_angle=-120,\r
+ end_angle=240\r
+ },\r
+ {\r
+ name='fs_used_perc',\r
+ arg='/',\r
+ max=100,\r
+ bg_colour=0xffffff,\r
+ bg_alpha=0.2,\r
+ fg_colour=0xffffff,\r
+ fg_alpha=0.3,\r
+ x=165, y=170,\r
+ radius=135,\r
+ thickness=50,\r
+ start_angle=-120,\r
+ end_angle=120\r
+ },\r
+}\r
+\r
+require 'cairo'\r
+\r
+function rgb_to_r_g_b(colour,alpha)\r
+ return ((colour / 0x10000) % 0x100) / 255., ((colour / 0x100) % 0x100) / 255., (colour % 0x100) / 255., alpha\r
+end\r
+\r
+function draw_ring(cr,t,pt)\r
+ local w,h=conky_window.width,conky_window.height\r
+\r
+ local xc,yc,ring_r,ring_w,sa,ea=pt['x'],pt['y'],pt['radius'],pt['thickness'],pt['start_angle'],pt['end_angle']\r
+ local bgc, bga, fgc, fga=pt['bg_colour'], pt['bg_alpha'], pt['fg_colour'], pt['fg_alpha']\r
+\r
+ local angle_0=sa*(2*math.pi/360)-math.pi/2\r
+ local angle_f=ea*(2*math.pi/360)-math.pi/2\r
+ local t_arc=t*(angle_f-angle_0)\r
+\r
+ -- Draw background ring\r
+\r
+ cairo_arc(cr,xc,yc,ring_r,angle_0,angle_f)\r
+ cairo_set_source_rgba(cr,rgb_to_r_g_b(bgc,bga))\r
+ cairo_set_line_width(cr,ring_w)\r
+ cairo_stroke(cr)\r
+\r
+ -- Draw indicator ring\r
+\r
+ cairo_arc(cr,xc,yc,ring_r,angle_0,angle_0+t_arc)\r
+ cairo_set_source_rgba(cr,rgb_to_r_g_b(fgc,fga))\r
+ cairo_stroke(cr) \r
+end\r
+\r
+function conky_ring_stats()\r
+ local function setup_rings(cr,pt)\r
+ local str=''\r
+ local value=0\r
+\r
+ str=string.format('${%s %s}',pt['name'],pt['arg'])\r
+ str=conky_parse(str)\r
+\r
+ value=tonumber(str)\r
+ if value == nil then value = 0 end\r
+ pct=value/pt['max']\r
+\r
+ draw_ring(cr,pct,pt)\r
+ end\r
+\r
+ if conky_window==nil then return end\r
+ local cs=cairo_xlib_surface_create(conky_window.display,conky_window.drawable,conky_window.visual, conky_window.width,conky_window.height)\r
+\r
+ local cr=cairo_create(cs) \r
+\r
+ local updates=conky_parse('${updates}')\r
+ update_num=tonumber(updates)\r
+\r
+ if update_num>5 then\r
+ for i in pairs(settings_table) do\r
+ setup_rings(cr,settings_table[i])\r
+ end\r
+ end\r
+ cairo_surface_destroy(cs)\r
+ cairo_destroy(cr)\r
+end\r
--- /dev/null
+--[[TEXT WIDGET v1.. by Wlourf 25/06/2010
+This widget can drawn texts set in the "text_settings" table with some parameters
+http://u-scripts.blogspot.com/2010/06/text-widget.html
+
+The parameters (all optionals) are :
+text - text to display, default = "Conky is good for you"
+ use conky_parse to display conky value ie text=conly_parse("${cpu cpu1}")
+ - coordinates below are relative to top left corner of the conky window
+x - x coordinate of first letter (bottom-left), default = center of conky window
+y - y coordinate of first letter (bottom-left), default = center of conky window
+h_align - horizontal alignement of text relative to point (x,y), default="l"
+ available values are "l": left, "c" : center, "r" : right
+v_align - vertical alignment of text relative to point (x,y), default="b"
+ available values "t" : top, "m" : middle, "b" : bottom
+font_name - name of font to use, default = Free Sans
+font_size - size of font to use, default = 14
+italic - display text in italic (true/false), default=false
+oblique - display text in oblique (true/false), default=false (I don' see the difference with italic!)
+bold - display text in bold (true/false), default=false
+angle - rotation of text in degrees, default = 0 (horizontal)
+colour - table of colours for text, default = plain white {{1,0xFFFFFF,1}}
+ this table contains one or more tables with format {P,C,A}
+ P=position of gradient (0 = beginning of text, 1= end of text)
+ C=hexadecimal colour
+ A=alpha (opacity) of color (0=invisible,1=opacity 100%)
+ Examples :
+ for a plain color {{1,0x00FF00,0.5}}
+ for a gradient with two colours {{0,0x00FF00,0.5},{1,0x000033,1}}
+ or {{0.5,0x00FF00,1},{1,0x000033,1}} -with this one, gradient will start in the middle of the text
+ for a gradient with three colours {{0,0x00FF00,0.5},{0.5,0x000033,1},{1,0x440033,1}}
+ and so on ...
+orientation - in case of gradient, "orientation" defines the starting point of the gradient, default="ww"
+ there are 8 available starting points : "nw","nn","ne","ee","se","ss","sw","ww"
+ (n for north, w for west ...)
+ theses 8 points are the 4 corners + the 4 middles of text's outline
+ so a gradient "nn" will go from "nn" to "ss" (top to bottom, parallele to text)
+ a gradient "nw" will go from "nw" to "se" (left-top corner to right-bottom corner)
+radial - define a radial gradient (if present at the same time as "orientation", "orientation" will have no effect)
+ this parameter is a table with 6 numbers : {xa,ya,ra,xb,yb,rb}
+ they define two circle for the gradient :
+ xa, ya, xb and yb are relative to x and y values above
+reflection_alpha - add a reflection effect (values from 0 to 1) default = 0 = no reflection
+ other values = starting opacity
+reflection_scale - scale of the reflection (default = 1 = height of text)
+reflection_length - length of reflection, define where the opacity will be set to zero
+ calues from 0 to 1, default =1
+skew_x,skew_y - skew text around x or y axis
+
+
+Needs conky 1.8.0
+
+To call this script in the conkyrc, in before-TEXT section:
+ lua_load /path/to/the/lua/script/text.lua
+ lua_draw_hook_pre draw_text
+
+v1.0 07/06/2010, Original release
+v1.1 10/06/2010 Add "orientation" parameter
+v1.2 15/06/2010 Add "h_align", "v_align" and "radial" parameters
+v1.3 25/06/2010 Add "reflection_alpha", "reflection_length", "reflection_scale",
+ "skew_x" et "skew_y"
+
+
+]]
+
+require 'cairo'
+
+function conky_draw_text()
+ local col0,col1,col2=0xFFFFCC,0xCCFF99,0x99FF00
+ local colbg=0x99CCFF
+ local text_settings={
+ {
+ text=conky_parse("${time %I:%M%p %D}"),
+ font_size=24,
+ bold=true,
+ font_name="Droid Sans Mono",
+ h_align="l",
+ v_align="t",
+ x=5,
+ y=5,
+ reflection_alpha=0,
+ reflection_length=0,
+ colour={
+ {0.98, 0xFF0000,1},
+ {0.99, 0xFFCC00,1},
+ {1.00, 0xFF0000,1},
+ },
+ radial={400,-700,0,100,-1000,1024}
+ },
+ {
+ text=conky_parse("$sysname $kernel on $machine - $uptime"),
+ font_size=16,
+ bold=true,
+ font_name="Droid Sans Mono",
+ h_align="r",
+ x=800,
+ y=15,
+ reflection_alpha=0,
+ reflection_length=0,
+ colour={{0,col0,0.75},{1,colbg,0.75}},
+
+ },
+ {
+ text=conky_parse("$freq MHz"),
+ font_name="Droid Sans Mono",
+ font_size=16,
+ h_align="l",
+ v_align="t",
+ bold=true,
+ x=20,
+ y=60,
+ reflection_alpha=0,
+ reflection_length=0,
+ colour={{0,col0,1},{0.5,colbg,1}},
+ orientation="nn",
+ },
+ {
+ text=conky_parse("${battery_temp}").."\194\176",--yes i had to do the degree symbol like that...
+ x=794,
+ y=69,
+ v_align="m",
+ h_align="r",
+ font_name="Droid Sans Mono",
+ font_size=14,
+ colour={{0,col0,1},{0.5,colbg,1}},
+ orientation="nn",
+ reflection_alpha=0,
+ reflection_length=0,
+ },
+ {
+ text=conky_parse("${battery_short} ${battery_volts}mV"),
+ x=794,
+ y=45,
+ v_align="m",
+ h_align="r",
+ font_name="Droid Sans Mono",
+ font_size=14,
+ colour={{0,col0,1},{0.5,colbg,1}},
+ orientation="nn",
+ reflection_alpha=0,
+ reflection_length=0,
+ },
+ {
+ text=conky_parse("${cell_radio_dbm}".."dBm"),
+ x=510,
+ y=50,
+ font_name="Droid Sans Mono",
+ font_size=14,
+ colour={{0,col0,1},{0.5,colbg,1}},
+ orientation="nn",
+ reflection_alpha=0.0,
+ reflection_length=0.0,
+ },
+ {
+ text=conky_parse('${cpu}').."%",
+ x=223,
+ y=65,
+ v_align="t",
+ h_align="l",
+ font_name="Droid Sans Mono",
+ font_size=18,
+ colour={{0,col0,1},{0.5,colbg,1}},
+ orientation="ww",
+ reflection_alpha=0,
+ reflection_length=0,
+ },
+ {
+ text=conky_parse('${memperc}').."%",
+ x=223,
+ y=91,
+ v_align="t",
+ font_name="Droid Sans Mono",
+ font_size=18,
+ colour={{0,col0,1},{0.5,colbg,1}},
+ orientation="nn",
+ reflection_alpha=0,
+ reflection_length=0,
+ },
+ {
+ text=conky_parse('${fs_used /} / ${fs_size /} (${fs_free /})'),
+ x=5,
+ y=115,
+ v_align="t",
+ font_name="Droid Sans Mono",
+ font_size=16,
+ colour={{conky_parse('${fs_used_perc /}')/100,0x000000,1},{1,0xFFFFFF,1}},
+ orientation="ww",
+ reflection_alpha=0,
+ reflection_length=0,
+ },
+ {
+ text="/",
+ x=220,
+ y=114,
+ v_align="t",
+ font_name="Droid Sans Mono",
+ font_size=18,
+ colour={{0,0x336633,1},{1,col0,1}},
+ bold=true,
+ orientation="ww",
+ reflection_alpha=0,
+ reflection_length=0,
+ },
+ {
+ text=conky_parse('${fs_used /home} / ${fs_size /home} (${fs_free /home})'),
+ x=5,
+ y=135,
+ v_align="t",
+ font_name="Droid Sans Mono",
+ font_size=16,
+ colour={{conky_parse('${fs_used_perc /home}')/100,0x000000,1},{1,0xFFFFFF,1}},
+ orientation="ww",
+ reflection_alpha=0,
+ reflection_length=0,
+ },
+ {
+ text="/home",
+ x=220,
+ y=134,
+ v_align="t",
+ font_name="Droid Sans Mono",
+ font_size=18,
+ colour={{0,0x336633,1},{1,col0,1}},
+ bold=true,
+ orientation="ww",
+ reflection_alpha=0,
+ reflection_length=0,
+ },
+ {
+ text=conky_parse('${fs_used /home/user/MyDocs} / ${fs_size /home/user/MyDocs} (${fs_free /home/user/MyDocs})'),
+ x=5,
+ y=155,
+ v_align="t",
+ font_name="Droid Sans Mono",
+ font_size=16,
+ colour={{conky_parse('${fs_used_perc /home/user/MyDocs}')/100-.1,0x000000,1},{1,0xFFFFFF,1}},
+ orientation="ww",
+ reflection_alpha=0,
+ reflection_length=0,
+ DrawMe=conky_parse("${if_mounted /home/user/MyDocs}1$endif")
+ },
+ {
+ text="MyDocs",
+ x=220,
+ y=154,
+ v_align="t",
+ font_name="Droid Sans Mono",
+ font_size=18,
+ colour={{0,0x336633,1},{1,col0,1}},
+ bold=true,
+ orientation="ww",
+ reflection_alpha=0,
+ reflection_length=0,
+ DrawMe=conky_parse("${if_mounted /home/user/MyDocs}1$endif")
+ },
+ {
+ text=conky_parse('${fs_used /media/mmc1} / ${fs_size /media/mmc1} (${fs_free /media/mmc1})'),
+ x=5,
+ y=175,
+ v_align="t",
+ font_name="Droid Sans Mono",
+ font_size=16,
+ colour={{conky_parse('${fs_used_perc /media/mmc1}')/100-.1,0x000000,1},{1,0xFFFFFF,1}},
+ orientation="ww",
+ reflection_alpha=0,
+ reflection_length=0,
+ DrawMe=conky_parse("${if_mounted /media/mmc1}1$endif")
+ },
+ {
+ text="SDCard",
+ x=220,
+ y=174,
+ v_align="t",
+ font_name="Droid Sans Mono",
+ font_size=18,
+ colour={{0,0x336633,1},{1,col0,1}},
+ bold=true,
+ orientation="ww",
+ reflection_alpha=0,
+ reflection_length=0,
+ DrawMe=conky_parse("${if_mounted /media/mmc1}1$endif"),
+ },
+ {
+ text=conky_parse('${wireless_essid wlan0}'),
+ x=400,
+ y=201,
+ h_align="c",
+ v_align="m",
+ font_name="Droid Sans Mono",
+ font_size=18,
+ colour={{0,col0,1},{0.5,colbg,1}},
+ orientation="nn",
+ reflection_alpha=0,
+ reflection_length=0,
+ DrawMe=conky_parse("${if_empty ${wireless_essid wlan0}}${else}1$endif"),
+ },
+ {
+ text="GPRS",
+ x=400,
+ y=201,
+ h_align="c",
+ v_align="m",
+ font_name="Droid Sans Mono",
+ font_size=18,
+ colour={{0,col0,1},{0.5,colbg,1}},
+ orientation="nn",
+ reflection_alpha=0,
+ reflection_length=0,
+ DrawMe=conky_parse("${if_up gprs0}1${else}0$endif"),
+ },
+ {
+ text=conky_parse('${wireless_link_qual_perc wlan0}')..'%',
+ x=400,
+ y=228,
+ h_align="c",
+ v_align="l",
+ font_name="Droid Sans Mono",
+ font_size=14,
+ colour={{0,col0,1},{0.5,colbg,1}},
+ orientation="nn",
+ reflection_alpha=0,
+ reflection_length=0,
+ DrawMe=conky_parse("${if_empty ${wireless_essid wlan0}}${else}1$endif"),
+ },
+ {
+ text='Up '..conky_parse('${upspeed wlan0}'),
+ x=225,
+ y=223,
+ h_align="l",
+ v_align="m",
+ font_name="LEDFont",
+ font_size=22,
+ bold=true,
+ colour={{0,0xcc0066,1}},
+ orientation="ww",
+ reflection_alpha=0,
+ reflection_length=0,
+ DrawMe=conky_parse("${if_empty ${wireless_essid wlan0}}${else}1$endif"),
+ },
+ {
+ text=conky_parse('${downspeed wlan0}')..' Down',
+ x=650,
+ y=223,
+ h_align="r",
+ v_align="m",
+ font_name="LEDFont",
+ font_size=22,
+ bold=true,
+ colour={{0,0xcc0066,1}},
+ orientation="ww",
+ reflection_alpha=0,
+ reflection_length=0,
+ DrawMe=conky_parse("${if_empty ${wireless_essid wlan0}}${else}1$endif"),
+ },
+ {
+ text='Up '..conky_parse('${upspeed gprs0}'),
+ x=225,
+ y=223,
+ h_align="l",
+ v_align="m",
+ font_name="LEDFont",
+ font_size=22,
+ bold=true,
+ colour={{0,0xcc0066,1}},
+ orientation="ww",
+ reflection_alpha=0,
+ reflection_length=0,
+ DrawMe=conky_parse("${if_up gprs0}1${else}0$endif"),
+ },
+ {
+ text=conky_parse('${downspeed gprs0}')..' Down',
+ x=650,
+ y=223,
+ h_align="r",
+ v_align="m",
+ font_name="LEDFont",
+ font_size=22,
+ bold=true,
+ colour={{0,0xcc0066,1}},
+ orientation="ww",
+ reflection_alpha=0,
+ reflection_length=0,
+ DrawMe=conky_parse("${if_up gprs0}1${else}0$endif"),
+ },
+ }
+ if conky_window == nil then return end
+ if tonumber(conky_parse("$updates"))<3 then return end
+ local cs = cairo_xlib_surface_create(conky_window.display, conky_window.drawable, conky_window.visual, conky_window.width, conky_window.height)
+ for i,v in pairs(text_settings) do
+ cr = cairo_create (cs)
+ display_text(v)
+ cairo_destroy(cr)
+ cr = nil
+ end
+ cairo_surface_destroy(cs)
+end
+
+function rgb_to_r_g_b2(tcolour)
+ local colour,alpha=tcolour[2],tcolour[3]
+ return ((colour / 0x10000) % 0x100) / 255., ((colour / 0x100) % 0x100) / 255., (colour % 0x100) / 255., alpha
+end
+
+function display_text(t)
+ if t.DrawMe~=nil and t.DrawMe ~= "1" then return end
+ local function set_pattern(te)
+ --this function set the pattern
+ if #t.colour==1 then
+ cairo_set_source_rgba(cr,rgb_to_r_g_b2(t.colour[1]))
+ else
+ local pat
+ if t.radial==nil then
+ local pts=linear_orientation(t,te)
+ pat = cairo_pattern_create_linear (pts[1],pts[2],pts[3],pts[4])
+ else
+ pat = cairo_pattern_create_radial (t.radial[1],t.radial[2],t.radial[3],t.radial[4],t.radial[5],t.radial[6])
+ end
+ for i=1, #t.colour do
+ cairo_pattern_add_color_stop_rgba (pat, t.colour[i][1], rgb_to_r_g_b2(t.colour[i]))
+ end
+ cairo_set_source (cr, pat)
+ cairo_pattern_destroy(pat)
+ end
+ end
+
+ --set default values if needed
+ if t.text==nil then t.text="Conky is good for you !" end
+ if t.x==nil then t.x = conky_window.width/2 end
+ if t.y==nil then t.y = conky_window.height/2 end
+ if t.colour==nil then t.colour={{1,0xFFFFFF,1}} end
+ if t.font_name==nil then t.font_name="Free Sans" end
+ if t.font_size==nil then t.font_size=14 end
+ if t.angle==nil then t.angle=0 end
+ if t.italic==nil then t.italic=false end
+ if t.oblique==nil then t.oblique=false end
+ if t.bold==nil then t.bold=false end
+ if t.radial ~= nil then
+ if #t.radial~=6 then
+ print ("error in radial table")
+ t.radial=nil
+ end
+ end
+ if t.orientation==nil then t.orientation="ww" end
+ if t.h_align==nil then t.h_align="l" end
+ if t.v_align==nil then t.v_align="b" end
+ if t.reflection_alpha == nil then t.reflection_alpha=0 end
+ if t.reflection_length == nil then t.reflection_length=1 end
+ if t.reflection_scale == nil then t.reflection_scale=1 end
+ if t.rotx==nil then t.rotx=0 end
+ if t.roty==nil then t.roty=0 end
+ cairo_translate(cr,t.x,t.y)
+ cairo_rotate(cr,t.angle*math.pi/180)
+ cairo_save(cr)
+ local slant = CAIRO_FONT_SLANT_NORMAL
+ local weight = CAIRO_FONT_WEIGHT_NORMAL
+ if t.italic then slant = CAIRO_FONT_SLANT_ITALIC end
+ if t.oblique then slant = CAIRO_FONT_SLANT_OBLIQUE end
+ if t.bold then weight = CAIRO_FONT_WEIGHT_BOLD end
+ cairo_select_font_face(cr, t.font_name, slant,weight)
+ for i=1, #t.colour do
+ if #t.colour[i]~=3 then
+ print ("error in color table")
+ t.colour[i]={1,0xFFFFFF,1}
+ end
+ end
+ local matrix0 = cairo_matrix_t:create()
+ tolua.takeownership(matrix0)
+ local rotx,roty=t.rotx/t.font_size,t.roty/t.font_size
+ cairo_matrix_init (matrix0, 1,roty,rotx,1,0,0)
+ cairo_transform(cr,matrix0)
+ cairo_set_font_size(cr,t.font_size)
+ local te=cairo_text_extents_t:create()
+ tolua.takeownership(te)
+ cairo_text_extents (cr,t.text,te)
+ set_pattern(te)
+ local mx,my=0,0
+ if t.h_align=="c" then
+ mx=-te.width/2
+ elseif t.h_align=="r" then
+ mx=-te.width
+ end
+ if t.v_align=="m" then
+ my=-te.height/2-te.y_bearing
+ elseif t.v_align=="t" then
+ my=-te.y_bearing
+ end
+ cairo_move_to(cr,mx,my)
+ cairo_show_text(cr,t.text)
+
+ if t.reflection_alpha ~= 0 then
+ local matrix1 = cairo_matrix_t:create()
+ tolua.takeownership(matrix1)
+ cairo_set_font_size(cr,t.font_size)
+ cairo_matrix_init (matrix1,1,0,0,-1*t.reflection_scale,0,(te.height+te.y_bearing+my)*(1+t.reflection_scale))
+ cairo_set_font_size(cr,t.font_size)
+ te=nil
+ local te=cairo_text_extents_t:create()
+ tolua.takeownership(te)
+ cairo_text_extents (cr,t.text,te)
+ cairo_transform(cr,matrix1)
+ set_pattern(te)
+ cairo_move_to(cr,mx,my)
+ cairo_show_text(cr,t.text)
+ local pat2 = cairo_pattern_create_linear (0,
+ (te.y_bearing+te.height+my),
+ 0,
+ te.y_bearing+my)
+ cairo_pattern_add_color_stop_rgba (pat2, 0,1,0,0,1-t.reflection_alpha)
+ cairo_pattern_add_color_stop_rgba (pat2, t.reflection_length,0,0,0,1)
+ cairo_set_line_width(cr,0)
+ local dy=te.x_bearing
+ if dy<0 then dy=dy*(-1) end
+ cairo_rectangle(cr,mx+te.x_bearing,te.y_bearing+te.height+my,te.width+dy,-te.height*1.05)
+ cairo_clip_preserve(cr)
+ cairo_set_operator(cr,CAIRO_OPERATOR_CLEAR)
+ --cairo_stroke(cr)
+ cairo_mask(cr,pat2)
+ cairo_pattern_destroy(pat2)
+ cairo_set_operator(cr,CAIRO_OPERATOR_OVER)
+ te=nil
+ end
+end
+
+
+ function linear_orientation(t,te)
+ local w,h=te.width,te.height
+ local xb,yb=te.x_bearing,te.y_bearing
+
+ if t.h_align=="c" then
+ xb=xb-w/2
+ elseif t.h_align=="r" then
+ xb=xb-w
+ end
+ if t.v_align=="m" then
+ yb=-h/2
+ elseif t.v_align=="t" then
+ yb=0
+ end
+ local p=0
+ if t.orientation=="nn" then
+ p={xb+w/2,yb,xb+w/2,yb+h}
+ elseif t.orientation=="ne" then
+ p={xb+w,yb,xb,yb+h}
+ elseif t.orientation=="ww" then
+ p={xb,h/2,xb+w,h/2}
+ elseif vorientation=="se" then
+ p={xb+w,yb+h,xb,yb}
+ elseif t.orientation=="ss" then
+ p={xb+w/2,yb+h,xb+w/2,yb}
+ elseif vorientation=="ee" then
+ p={xb+w,h/2,xb,h/2}
+ elseif t.orientation=="sw" then
+ p={xb,yb+h,xb+w,yb}
+ elseif t.orientation=="nw" then
+ p={xb,yb,xb+w,yb+h}
+ end
+ return p
+end
+
am__conky_SOURCES_DIST = defconfig.h conf_cookie.c conf_cookie.h \
audacious.c audacious.h bmpx.c bmpx.h ibm.c ibm.h smapi.c \
smapi.h mpd.c mpd.h libmpdclient.c libmpdclient.h moc.c moc.h \
- xmms2.c xmms2.h linux.c linux.h top.c top.h users.c sony.c \
- sony.h i8k.c i8k.h freebsd.c freebsd.h openbsd.c openbsd.h \
- libtcp-portmon.c libtcp-portmon.h tcp-portmon.c tcp-portmon.h \
- x11.c x11.h fonts.c fonts.h hddtemp.c hddtemp.h eve.c eve.h \
- ccurl_thread.c ccurl_thread.h rss.c rss.h prss.c prss.h \
- weather.c weather.h llua.c llua.h nvidia.c nvidia.h imlib2.c \
- imlib2.h apcupsd.c apcupsd.h iconv_tools.c iconv_tools.h \
- colours.c colours.h combine.c combine.h common.c common.h \
- conky.c conky.h core.c core.h diskio.c diskio.h entropy.c \
- entropy.h exec.c exec.h fs.c fs.h logging.h mail.c mail.h \
- mixer.c mixer.h net_stat.c net_stat.h template.c template.h \
- timed_thread.c timed_thread.h mboxscan.c mboxscan.h read_tcp.c \
- read_tcp.h scroll.c scroll.h specials.c specials.h tailhead.c \
- tailhead.h temphelper.c temphelper.h text_object.c \
- text_object.h timeinfo.c timeinfo.h algebra.c algebra.h proc.c \
- proc.h user.c user.h
+ xmms2.c xmms2.h linux.c linux.h users.c sony.c sony.h i8k.c \
+ i8k.h freebsd.c freebsd.h openbsd.c openbsd.h libtcp-portmon.c \
+ libtcp-portmon.h tcp-portmon.c tcp-portmon.h x11.c x11.h \
+ fonts.c fonts.h hddtemp.c hddtemp.h eve.c eve.h ccurl_thread.c \
+ ccurl_thread.h rss.c rss.h prss.c prss.h weather.c weather.h \
+ llua.c llua.h nvidia.c nvidia.h imlib2.c imlib2.h apcupsd.c \
+ apcupsd.h iconv_tools.c iconv_tools.h colours.c colours.h \
+ combine.c combine.h common.c common.h conky.c conky.h core.c \
+ core.h diskio.c diskio.h entropy.c entropy.h exec.c exec.h \
+ fs.c fs.h logging.h mail.c mail.h mixer.c mixer.h net_stat.c \
+ net_stat.h template.c template.h timed_thread.c timed_thread.h \
+ mboxscan.c mboxscan.h read_tcp.c read_tcp.h scroll.c scroll.h \
+ specials.c specials.h tailhead.c tailhead.h temphelper.c \
+ temphelper.h text_object.c text_object.h timeinfo.c timeinfo.h \
+ algebra.c algebra.h proc.c proc.h user.c user.h top.c top.h
am__objects_1 =
@BUILD_CONFIG_OUTPUT_TRUE@am__objects_2 = conky-conf_cookie.$(OBJEXT)
am__objects_3 = conky-audacious.$(OBJEXT)
@BUILD_MOC_TRUE@am__objects_12 = $(am__objects_11)
am__objects_13 = conky-xmms2.$(OBJEXT)
@BUILD_XMMS2_TRUE@am__objects_14 = $(am__objects_13)
-am__objects_15 = conky-linux.$(OBJEXT) conky-top.$(OBJEXT) \
- conky-users.$(OBJEXT) conky-sony.$(OBJEXT) conky-i8k.$(OBJEXT)
+am__objects_15 = conky-linux.$(OBJEXT) conky-users.$(OBJEXT) \
+ conky-sony.$(OBJEXT) conky-i8k.$(OBJEXT)
@BUILD_LINUX_TRUE@am__objects_16 = $(am__objects_15)
am__objects_17 = conky-freebsd.$(OBJEXT)
@BUILD_FREEBSD_TRUE@am__objects_18 = $(am__objects_17)
conky-specials.$(OBJEXT) conky-tailhead.$(OBJEXT) \
conky-temphelper.$(OBJEXT) conky-text_object.$(OBJEXT) \
conky-timeinfo.$(OBJEXT) conky-algebra.$(OBJEXT) \
- conky-proc.$(OBJEXT) conky-user.$(OBJEXT)
+ conky-proc.$(OBJEXT) conky-user.$(OBJEXT) conky-top.$(OBJEXT)
am_conky_OBJECTS = $(am__objects_1) $(am__objects_2) $(am__objects_45) \
$(am__objects_46)
conky_OBJECTS = $(am_conky_OBJECTS)
mboxscan.h read_tcp.c read_tcp.h scroll.c scroll.h specials.c \
specials.h tailhead.c tailhead.h temphelper.c temphelper.h \
text_object.c text_object.h timeinfo.c timeinfo.h algebra.c \
- algebra.h proc.c proc.h user.c user.h
+ algebra.h proc.c proc.h user.c user.h top.c top.h
# source files only needed when the apropriate option is enabled
mpd = mpd.c mpd.h libmpdclient.c libmpdclient.h
moc = moc.c moc.h
xmms2 = xmms2.c xmms2.h
-linux = linux.c linux.h top.c top.h users.c sony.c sony.h i8k.c i8k.h
+linux = linux.c linux.h users.c sony.c sony.h i8k.c i8k.h
solaris = solaris.c
freebsd = freebsd.c freebsd.h
netbsd = netbsd.c netbsd.h
@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
@am__fastdepCC_FALSE@ $(LIBTOOL) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(conky_CFLAGS) $(CFLAGS) -c -o conky-linux.lo `test -f 'linux.c' || echo '$(srcdir)/'`linux.c
-conky-top.o: top.c
-@am__fastdepCC_TRUE@ if $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(conky_CFLAGS) $(CFLAGS) -MT conky-top.o -MD -MP -MF "$(DEPDIR)/conky-top.Tpo" -c -o conky-top.o `test -f 'top.c' || echo '$(srcdir)/'`top.c; \
-@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/conky-top.Tpo" "$(DEPDIR)/conky-top.Po"; else rm -f "$(DEPDIR)/conky-top.Tpo"; exit 1; fi
-@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='top.c' object='conky-top.o' libtool=no @AMDEPBACKSLASH@
-@AMDEP_TRUE@@am__fastdepCC_FALSE@ depfile='$(DEPDIR)/conky-top.Po' tmpdepfile='$(DEPDIR)/conky-top.TPo' @AMDEPBACKSLASH@
-@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
-@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(conky_CFLAGS) $(CFLAGS) -c -o conky-top.o `test -f 'top.c' || echo '$(srcdir)/'`top.c
-
-conky-top.obj: top.c
-@am__fastdepCC_TRUE@ if $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(conky_CFLAGS) $(CFLAGS) -MT conky-top.obj -MD -MP -MF "$(DEPDIR)/conky-top.Tpo" -c -o conky-top.obj `if test -f 'top.c'; then $(CYGPATH_W) 'top.c'; else $(CYGPATH_W) '$(srcdir)/top.c'; fi`; \
-@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/conky-top.Tpo" "$(DEPDIR)/conky-top.Po"; else rm -f "$(DEPDIR)/conky-top.Tpo"; exit 1; fi
-@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='top.c' object='conky-top.obj' libtool=no @AMDEPBACKSLASH@
-@AMDEP_TRUE@@am__fastdepCC_FALSE@ depfile='$(DEPDIR)/conky-top.Po' tmpdepfile='$(DEPDIR)/conky-top.TPo' @AMDEPBACKSLASH@
-@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
-@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(conky_CFLAGS) $(CFLAGS) -c -o conky-top.obj `if test -f 'top.c'; then $(CYGPATH_W) 'top.c'; else $(CYGPATH_W) '$(srcdir)/top.c'; fi`
-
-conky-top.lo: top.c
-@am__fastdepCC_TRUE@ if $(LIBTOOL) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(conky_CFLAGS) $(CFLAGS) -MT conky-top.lo -MD -MP -MF "$(DEPDIR)/conky-top.Tpo" -c -o conky-top.lo `test -f 'top.c' || echo '$(srcdir)/'`top.c; \
-@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/conky-top.Tpo" "$(DEPDIR)/conky-top.Plo"; else rm -f "$(DEPDIR)/conky-top.Tpo"; exit 1; fi
-@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='top.c' object='conky-top.lo' libtool=yes @AMDEPBACKSLASH@
-@AMDEP_TRUE@@am__fastdepCC_FALSE@ depfile='$(DEPDIR)/conky-top.Plo' tmpdepfile='$(DEPDIR)/conky-top.TPlo' @AMDEPBACKSLASH@
-@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
-@am__fastdepCC_FALSE@ $(LIBTOOL) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(conky_CFLAGS) $(CFLAGS) -c -o conky-top.lo `test -f 'top.c' || echo '$(srcdir)/'`top.c
-
conky-users.o: users.c
@am__fastdepCC_TRUE@ if $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(conky_CFLAGS) $(CFLAGS) -MT conky-users.o -MD -MP -MF "$(DEPDIR)/conky-users.Tpo" -c -o conky-users.o `test -f 'users.c' || echo '$(srcdir)/'`users.c; \
@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/conky-users.Tpo" "$(DEPDIR)/conky-users.Po"; else rm -f "$(DEPDIR)/conky-users.Tpo"; exit 1; fi
@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
@am__fastdepCC_FALSE@ $(LIBTOOL) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(conky_CFLAGS) $(CFLAGS) -c -o conky-user.lo `test -f 'user.c' || echo '$(srcdir)/'`user.c
+conky-top.o: top.c
+@am__fastdepCC_TRUE@ if $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(conky_CFLAGS) $(CFLAGS) -MT conky-top.o -MD -MP -MF "$(DEPDIR)/conky-top.Tpo" -c -o conky-top.o `test -f 'top.c' || echo '$(srcdir)/'`top.c; \
+@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/conky-top.Tpo" "$(DEPDIR)/conky-top.Po"; else rm -f "$(DEPDIR)/conky-top.Tpo"; exit 1; fi
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='top.c' object='conky-top.o' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ depfile='$(DEPDIR)/conky-top.Po' tmpdepfile='$(DEPDIR)/conky-top.TPo' @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(conky_CFLAGS) $(CFLAGS) -c -o conky-top.o `test -f 'top.c' || echo '$(srcdir)/'`top.c
+
+conky-top.obj: top.c
+@am__fastdepCC_TRUE@ if $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(conky_CFLAGS) $(CFLAGS) -MT conky-top.obj -MD -MP -MF "$(DEPDIR)/conky-top.Tpo" -c -o conky-top.obj `if test -f 'top.c'; then $(CYGPATH_W) 'top.c'; else $(CYGPATH_W) '$(srcdir)/top.c'; fi`; \
+@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/conky-top.Tpo" "$(DEPDIR)/conky-top.Po"; else rm -f "$(DEPDIR)/conky-top.Tpo"; exit 1; fi
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='top.c' object='conky-top.obj' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ depfile='$(DEPDIR)/conky-top.Po' tmpdepfile='$(DEPDIR)/conky-top.TPo' @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(conky_CFLAGS) $(CFLAGS) -c -o conky-top.obj `if test -f 'top.c'; then $(CYGPATH_W) 'top.c'; else $(CYGPATH_W) '$(srcdir)/top.c'; fi`
+
+conky-top.lo: top.c
+@am__fastdepCC_TRUE@ if $(LIBTOOL) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(conky_CFLAGS) $(CFLAGS) -MT conky-top.lo -MD -MP -MF "$(DEPDIR)/conky-top.Tpo" -c -o conky-top.lo `test -f 'top.c' || echo '$(srcdir)/'`top.c; \
+@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/conky-top.Tpo" "$(DEPDIR)/conky-top.Plo"; else rm -f "$(DEPDIR)/conky-top.Tpo"; exit 1; fi
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='top.c' object='conky-top.lo' libtool=yes @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ depfile='$(DEPDIR)/conky-top.Plo' tmpdepfile='$(DEPDIR)/conky-top.TPlo' @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@ $(LIBTOOL) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(conky_CFLAGS) $(CFLAGS) -c -o conky-top.lo `test -f 'top.c' || echo '$(srcdir)/'`top.c
+
mostlyclean-libtool:
-rm -f *.lo
/* Default maximum size of config TEXT buffer, i.e. below TEXT line. */
#undef MAX_USER_TEXT_DEFAULT
-/* Define if the mixers use ALSA */
-#undef MIXER_IS_ALSA
-
/* Define if you want MOC support */
#undef MOC
BUILD_CONFIG_OUTPUT_TRUE =
BUILD_CURL_FALSE =
BUILD_CURL_TRUE = #
-BUILD_DATE = Sat Dec 18 01:10:47 PST 2010
+BUILD_DATE = Sat Dec 18 15:29:05 PST 2010
BUILD_EVE_FALSE =
BUILD_EVE_TRUE = #
BUILD_FREEBSD_FALSE =
PACKAGE = conky
PACKAGE_BUGREPORT = brenden1@users.sourceforge.net
PACKAGE_NAME = Conky
-PACKAGE_STRING = Conky 1.8.5
+PACKAGE_STRING = Conky 1.8.5_pre2390
PACKAGE_TARNAME = conky
-PACKAGE_VERSION = 1.8.5
+PACKAGE_VERSION = 1.8.5_pre2390
PATH_SEPARATOR = :
PKG_CONFIG = /scratchbox/tools/bin/pkg-config
RANLIB = ranlib
SET_MAKE =
SHELL = /bin/sh
STRIP = strip
-VERSION = 1.8.5
+VERSION = 1.8.5_pre2390
X11_CFLAGS =
X11_LIBS = -lX11
XDamage_CFLAGS =