From 34b5637a4627b48a700d450eb034dc33000ab023 Mon Sep 17 00:00:00 2001 From: Brenden Matthews Date: Thu, 25 Aug 2005 04:00:55 +0000 Subject: [PATCH] updated todo; fixed scale for netgraphs (sf.net feature request 1256921); fixed small bug in ebuild; doc updates. git-svn-id: https://conky.svn.sourceforge.net/svnroot/conky/trunk/conky@178 7f574dfc-610e-0410-a909-a81674777703 --- ChangeLog | 1 + README | 54 +++++++++++++++++----------------- TODO | 23 +++++++-------- app-admin/conky/conky-1.9999.ebuild | 2 +- doc/variables.xml | 10 +++---- src/conky.c | 55 ++++++++++++++++++++++------------- 6 files changed, 79 insertions(+), 66 deletions(-) diff --git a/ChangeLog b/ChangeLog index 30398f0..1e02fe8 100644 --- a/ChangeLog +++ b/ChangeLog @@ -2,6 +2,7 @@ 2005-08-24 * More configure and makefile updates + * Added scale arg for net graphs 2005-08-23 * Added maximum_width diff --git a/README b/README index f276c0c..cb65c23 100644 --- a/README +++ b/README @@ -358,8 +358,9 @@ VARIABLES downspeedgraph net, (height),(width) (gradient colour 1) (gradient - colour 2) - Download speed graph, colours defined in hex, minus the #. + colour 2) (scale) + Download speed graph, colours defined in hex, minus the #. If + scale is non-zero, it becomes the scale for the graph. else Text to show if any of the above are not true @@ -367,22 +368,22 @@ VARIABLES exec command Executes a shell command and displays the output in conky. warn- - ing: this takes a lot more resources than other variables. I'd + ing: this takes a lot more resources than other variables. I'd recommend coding wanted behaviour in C and posting a patch. execbar command - Same as exec, except if the first value return is a value - between 0-100, it will use that number for a bar. The size for + Same as exec, except if the first value return is a value + between 0-100, it will use that number for a bar. The size for the bar is currently fixed, but that may change in the future. execgraph command - Same as execbar, but graphs values + Same as execbar, but graphs values. execi interval command - Same as exec but with specific interval. Interval can't be less + Same as exec but with specific interval. Interval can't be less than update_interval in configuration. @@ -405,7 +406,7 @@ VARIABLES fs_bar (height),(width) fs - Bar that shows how much space is used on a file system. height + Bar that shows how much space is used on a file system. height is the height in pixels. fs is any file on that file system. @@ -430,25 +431,25 @@ VARIABLES i2c (dev), type, n - I2C sensor from sysfs (Linux 2.6). dev may be omitted if you - have only one I2C device. type is either in (or vol) meaning + I2C sensor from sysfs (Linux 2.6). dev may be omitted if you + have only one I2C device. type is either in (or vol) meaning voltage, fan meaning fan or temp/tempf (first in C, second in F) - meaning temperature. n is number of the sensor. See + meaning temperature. n is number of the sensor. See /sys/bus/i2c/devices/ on your local computer. if_running (process) - if PROCESS is running, display everything if_running and the + if PROCESS is running, display everything if_running and the matching $endif if_existing (file) - if FILE exists, display everything between if_existing and the + if FILE exists, display everything between if_existing and the matching $endif if_mounted (mountpoint) - if MOUNTPOINT is mounted, display everything between if_mounted + if MOUNTPOINT is mounted, display everything between if_mounted and the matching $endif @@ -468,8 +469,8 @@ VARIABLES Machine, i686 for example - mails Mail count in mail spool. You can use program like fetchmail to - get mails from some server using your favourite protocol. See + mails Mail count in mail spool. You can use program like fetchmail to + get mails from some server using your favourite protocol. See also new_mails. @@ -623,27 +624,27 @@ VARIABLES Move text over by N pixels. See also $voffset. - tail logfile, lines interval> Displays last N lines of supplied text + tail logfile, lines interval> Displays last N lines of supplied text text file. If interval is not supplied, Conky assumes 2x Conky's interval. Max of 30 lines. Max of 30 lines can be displayed. time (format) - Local time, see man strftime to get more information about for- + Local time, see man strftime to get more information about for- mat totaldown net - Total download, overflows at 4 GB on Linux with 32-bit arch and - there doesn't seem to be a way to know how many times it has + Total download, overflows at 4 GB on Linux with 32-bit arch and + there doesn't seem to be a way to know how many times it has already done that before conky has started. top type, num - This takes arguments in the form:top (name) (number) Basically, - processes are ranked from highest to lowest in terms of cpu - usage, which is what (num) represents. The types are: "name", - "pid", "cpu", and mem". There can be a max of 10 processes + This takes arguments in the form:top (name) (number) Basically, + processes are ranked from highest to lowest in terms of cpu + usage, which is what (num) represents. The types are: "name", + "pid", "cpu", and mem". There can be a max of 10 processes listed. @@ -668,8 +669,9 @@ VARIABLES upspeedgraph net, (height),(width) (gradient colour 1) (gradient colour - 2) - Upload speed graph, colours defined in hex, minus the #. + 2) (scale) + Upload speed graph, colours defined in hex, minus the #. If + scale is non-zero, it becomes the scale for the graph. uptime Uptime diff --git a/TODO b/TODO index edcd5fb..b616f14 100644 --- a/TODO +++ b/TODO @@ -2,19 +2,16 @@ Heres a very simplified roadmap for Conky. By no means does this mean any of this stuff will actually get implemented. -1.3 - * simple buttons? - * icecast status - * rewrite parts of code, making them more effecient and modular (in particular, the way objects are handled is a complete mess) - * conditional colours (ie if temp > 40C, make it red) - * think of new features to add - * max_width - * move things out of conky.c, since it's far too big - * better xinerama support, allow display1:0,0 et cetera -1.4 - * ideas needed -1.5 (maybe in december?) - * network transparency +1.3.0 - probably end of august/beginning of sept + * make it rock-solid + * release ASAP + +after 1.3.0 only maintenance releases will follow, no new features for the 1.x series + +2.0.0 - hopefully by christmas at the latest + * rewrite core of Conky in C++ + * implement new features like a cairo backend, network transparency, and whatever else + ###################################### # POSSIBLE FEATURES TO ADD # diff --git a/app-admin/conky/conky-1.9999.ebuild b/app-admin/conky/conky-1.9999.ebuild index 97a0c7a..4a13cc8 100644 --- a/app-admin/conky/conky-1.9999.ebuild +++ b/app-admin/conky/conky-1.9999.ebuild @@ -53,7 +53,7 @@ src_compile() { src_install() { emake DESTDIR=${D} install || die "make install failed" - dodoc ChangeLog AUTHORS README conkyrc.sample + dodoc ChangeLog AUTHORS README doc/conkyrc.sample } pkg_postinst() { diff --git a/doc/variables.xml b/doc/variables.xml index f05487f..8913bf8 100644 --- a/doc/variables.xml +++ b/doc/variables.xml @@ -173,10 +173,10 @@ - + - Download speed graph, colours defined in hex, minus the #. + Download speed graph, colours defined in hex, minus the #. If scale is non-zero, it becomes the scale for the graph. @@ -215,7 +215,7 @@ - Same as execbar, but graphs values + Same as execbar, but graphs values. @@ -865,10 +865,10 @@ - + - Upload speed graph, colours defined in hex, minus the #. + Upload speed graph, colours defined in hex, minus the #. If scale is non-zero, it becomes the scale for the graph. diff --git a/src/conky.c b/src/conky.c index b778e14..eedfee3 100644 --- a/src/conky.c +++ b/src/conky.c @@ -503,6 +503,9 @@ static void new_font(char *buf, char * args) { inline void graph_append(struct special_t *graph, double f) { + if (!graph->scaled && f > graph->graph_scale) { + f = graph->graph_scale; + } int i; if (graph->scaled) { graph->graph_scale = 0; @@ -516,28 +519,32 @@ inline void graph_append(struct special_t *graph, double f) } } -static void new_graph(char *buf, int w, int h, unsigned int first_colour, unsigned int second_colour, double i, int scaled, int append) +static void new_graph(char *buf, int w, int h, unsigned int first_colour, unsigned int second_colour, double i, int scale, int append) { struct special_t *s = new_special(buf, GRAPH); s->width = w; s->height = h; s->first_colour = first_colour; s->last_colour = second_colour; - s->scaled = scaled; + if (scale != 0) { + s->scaled = 0; + } else { + s->scaled = 1; + } if (s->width) { s->graph_width = s->width - 3; // subtract 3 for rectangle around } - if (scaled) { + if (s->scaled) { s->graph_scale = 1; } else { - s->graph_scale = 100; + s->graph_scale = scale; } if (append) { graph_append(s, i); } } -static const char *scan_graph(const char *args, int *w, int *h, unsigned int *first_colour, unsigned int *last_colour) +static const char *scan_graph(const char *args, int *w, int *h, unsigned int *first_colour, unsigned int *last_colour, unsigned int *scale) { *w = 0; /* zero width means all space that is available */ *h = 25; @@ -545,9 +552,13 @@ static const char *scan_graph(const char *args, int *w, int *h, unsigned int *fi *last_colour = 0; /* graph's argument is either height or height,width */ if (args) { - if (sscanf(args, "%*s %d,%d %x %x", h, w, first_colour, last_colour) < 4) { - if (sscanf(args, "%d,%d %x %x", h, w, first_colour, last_colour) < 4) { - *w = 0; + if (sscanf(args, "%*s %d,%d %x %x %i", h, w, first_colour, last_colour, scale) < 5) { + if (sscanf(args, "%*s %d,%d %x %x", h, w, first_colour, last_colour) < 4) { + *scale = 0; + if (sscanf(args, "%d,%d %x %x %i", h, w, first_colour, last_colour, scale) < 5) { + *scale = 0; + if (sscanf(args, "%d,%d %x %x", h, w, first_colour, last_colour) < 4) { + *w = 0; *h = 25; if (sscanf(args, "%*s %x %x", first_colour, last_colour) < 3) { *w = 0; @@ -560,11 +571,13 @@ static const char *scan_graph(const char *args, int *w, int *h, unsigned int *fi *last_colour = 0; sscanf(args, "%*s %d,%d", h, w); } - } + }} + } } } } } + printf("scale is %i\n", *scale); return args; } @@ -804,7 +817,7 @@ enum text_object_type { struct text_object { int type; int a, b; - unsigned int c, d; + unsigned int c, d, e; union { char *s; /* some string */ int i; /* some integer */ @@ -986,7 +999,7 @@ if (s[0] == '#') { END OBJ(cpubar, INFO_CPU) (void) scan_bar(arg, &obj->data.pair.a, &obj->data.pair.b); END OBJ(cpugraph, INFO_CPU) - (void) scan_graph(arg, &obj->a, &obj->b, &obj->c, &obj->d); + (void) scan_graph(arg, &obj->a, &obj->b, &obj->c, &obj->d, &obj->e); END OBJ(color, 0) #ifdef X11 obj->data.l = arg ? get_x11_color(arg) : default_fg_color; @@ -998,7 +1011,7 @@ if (s[0] == '#') { OBJ(downspeed, INFO_NET) obj->data.net = get_net_stat(arg); END OBJ(downspeedf, INFO_NET) obj->data.net = get_net_stat(arg); END OBJ(downspeedgraph, INFO_NET) - (void) scan_graph(arg, &obj->a, &obj->b, &obj->c, &obj->d); + (void) scan_graph(arg, &obj->a, &obj->b, &obj->c, &obj->d, &obj->e); char buf[64]; sscanf(arg, "%63s %*i,%*i %*i", buf); obj->data.net = get_net_stat(buf); @@ -1335,7 +1348,7 @@ if (s[0] == '#') { END OBJ(membar, INFO_MEM) (void) scan_bar(arg, &obj->data.pair.a, &obj->data.pair.b); END OBJ(memgraph, INFO_MEM) - (void) scan_graph(arg, &obj->a, &obj->b, &obj->c, &obj->d); + (void) scan_graph(arg, &obj->a, &obj->b, &obj->c, &obj->d, &obj->e); END OBJ(mixer, INFO_MIXER) obj->data.l = mixer_init(arg); END OBJ(mixerl, INFO_MIXER) obj->data.l = mixer_init(arg); END OBJ(mixerr, INFO_MIXER) obj->data.l = mixer_init(arg); @@ -1408,7 +1421,7 @@ int a = stippled_borders, b = 1; END OBJ(upspeed, INFO_NET) obj->data.net = get_net_stat(arg); END OBJ(upspeedf, INFO_NET) obj->data.net = get_net_stat(arg); END OBJ(upspeedgraph, INFO_NET) - (void) scan_graph(arg, &obj->a, &obj->b, &obj->c, &obj->d); + (void) scan_graph(arg, &obj->a, &obj->b, &obj->c, &obj->d, &obj->e); char buf[64]; sscanf(arg, "%63s %*i,%*i %*i", buf); obj->data.net = get_net_stat(buf); @@ -1665,7 +1678,7 @@ static void generate_text() new_graph(p, obj->a, obj->b, obj->c, obj->d, (unsigned int) (cur->cpu_usage * - 100), 0, 1); + 100), 100, 1); } OBJ(color) { new_fg(p, obj->data.l); @@ -1702,7 +1715,7 @@ static void generate_text() obj->data.net->recv_speed = 0.01; new_graph(p, obj->a, obj->b, obj->c, obj->d, (obj->data.net->recv_speed / - 1024.0), 1, 1); + 1024.0), obj->e, 1); } OBJ( else @@ -1800,7 +1813,7 @@ static void generate_text() ERR("your execgraph value is not between 0 and 100, therefore it will be ignored"); } else { new_graph(p, 0, - 25, obj->c, obj->d, (int) (barnum), 0, 1); + 25, obj->c, obj->d, (int) (barnum), obj->e, 1); } } @@ -1837,7 +1850,7 @@ static void generate_text() } OBJ(execigraph) { if (current_update_time - obj->data.execi.last_update < obj->data.execi.interval) { - new_graph(p, 0, 25, obj->c, obj->d, (int) (obj->data.execi.data), 0, 0); + new_graph(p, 0, 25, obj->c, obj->d, (int) (obj->data.execi.data), obj->e, 0); } else { char *p2 = p; FILE *fp = popen(obj->data.s, "r"); @@ -1860,7 +1873,7 @@ static void generate_text() ERR("your execigraph value is not between 0 and 100, therefore it will be ignored"); } else { obj->data.execi.data = barnum; - new_graph(p, 0, 25, obj->c, obj->d, (int) (obj->data.execi.data), 0, 1); + new_graph(p, 0, 25, obj->c, obj->d, (int) (obj->data.execi.data), obj->e, 1); } obj->data.execi.last_update = current_update_time; @@ -2102,7 +2115,7 @@ static void generate_text() new_graph(p, obj->a, obj->b, obj->c, obj->d, cur->memmax ? (cur->mem * 100.0) / - (cur->memmax) : 0.0, 0, 1); + (cur->memmax) : 0.0, 100, 1); } /* mixer stuff */ OBJ(mixer) { @@ -2305,7 +2318,7 @@ static void generate_text() obj->data.net->trans_speed = 0.01; new_graph(p, obj->a, obj->b, obj->c, obj->d, (obj->data.net->trans_speed / - 1024.0), 1, 1); + 1024.0), obj->e, 1); } OBJ(uptime_short) { format_seconds_short(p, n, -- 1.7.9.5