mirror of
https://github.com/Llewellynvdm/conky.git
synced 2024-11-17 18:45:10 +00:00
Special default & gauge fixes.
This commit is contained in:
parent
acfef7760f
commit
506f6ecc3b
67
README
67
README
@ -1642,6 +1642,7 @@ conky(1) conky(1)
|
|||||||
|
|
||||||
[1mtab (width, (start))[0m
|
[1mtab (width, (start))[0m
|
||||||
Puts a tab of the specified width, starting from column 'start'.
|
Puts a tab of the specified width, starting from column 'start'.
|
||||||
|
The unit is pixels for both arguments.
|
||||||
|
|
||||||
|
|
||||||
[1mtail logfile lines (interval)[0m
|
[1mtail logfile lines (interval)[0m
|
||||||
@ -1651,14 +1652,14 @@ conky(1) conky(1)
|
|||||||
|
|
||||||
|
|
||||||
[1mtemplateN (arg1) (arg2) (arg3 ...)[0m
|
[1mtemplateN (arg1) (arg2) (arg3 ...)[0m
|
||||||
Evaluate the content of the templateN configuration variable
|
Evaluate the content of the templateN configuration variable
|
||||||
(where N is a value between 0 and 9, inclusively), applying sub‐
|
(where N is a value between 0 and 9, inclusively), applying sub‐
|
||||||
stitutions as described in the documentation of the correspond‐
|
stitutions as described in the documentation of the correspond‐
|
||||||
ing configuration variable. The number of arguments is option‐
|
ing configuration variable. The number of arguments is option‐
|
||||||
al, but must match the highest referred index in the template.
|
al, but must match the highest referred index in the template.
|
||||||
You can use the same special sequences in each argument as the
|
You can use the same special sequences in each argument as the
|
||||||
ones valid for a template definition, e.g. to allow an argument
|
ones valid for a template definition, e.g. to allow an argument
|
||||||
to contain a whitespace. Also simple nesting of templates is
|
to contain a whitespace. Also simple nesting of templates is
|
||||||
possible this way.
|
possible this way.
|
||||||
|
|
||||||
Here are some examples of template definitions:
|
Here are some examples of template definitions:
|
||||||
@ -1667,7 +1668,7 @@ conky(1) conky(1)
|
|||||||
template1 \1: ${fs_used \2} / ${fs_size \2}
|
template1 \1: ${fs_used \2} / ${fs_size \2}
|
||||||
template2 \1 \2
|
template2 \1 \2
|
||||||
|
|
||||||
The following list shows sample usage of the templates defined
|
The following list shows sample usage of the templates defined
|
||||||
above, with the equivalent syntax when not using any template at
|
above, with the equivalent syntax when not using any template at
|
||||||
all:
|
all:
|
||||||
|
|
||||||
@ -1680,7 +1681,7 @@ conky(1) conky(1)
|
|||||||
|
|
||||||
|
|
||||||
[1mtime (format)[0m
|
[1mtime (format)[0m
|
||||||
Local time, see man strftime to get more information about for‐
|
Local time, see man strftime to get more information about for‐
|
||||||
mat
|
mat
|
||||||
|
|
||||||
|
|
||||||
@ -1689,23 +1690,23 @@ conky(1) conky(1)
|
|||||||
|
|
||||||
|
|
||||||
[1mtztime (timezone) (format)[0m
|
[1mtztime (timezone) (format)[0m
|
||||||
Local time for specified timezone, see man strftime to get more
|
Local time for specified timezone, see man strftime to get more
|
||||||
information about format. The timezone argument is specified in
|
information about format. The timezone argument is specified in
|
||||||
similar fashion as TZ environment variable. For hints, look in
|
similar fashion as TZ environment variable. For hints, look in
|
||||||
/usr/share/zoneinfo. e.g. US/Pacific, Europe/Zurich, etc.
|
/usr/share/zoneinfo. e.g. US/Pacific, Europe/Zurich, etc.
|
||||||
|
|
||||||
|
|
||||||
[1mtotaldown net[0m
|
[1mtotaldown net[0m
|
||||||
Total download, overflows at 4 GB on Linux with 32-bit arch and
|
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 al‐
|
there doesn't seem to be a way to know how many times it has al‐
|
||||||
ready done that before conky has started.
|
ready done that before conky has started.
|
||||||
|
|
||||||
|
|
||||||
[1mtop type, num[0m
|
[1mtop type, num[0m
|
||||||
This takes arguments in the form:top (name) (number) Basically,
|
This takes arguments in the form:top (name) (number) Basically,
|
||||||
processes are ranked from highest to lowest in terms of cpu us‐
|
processes are ranked from highest to lowest in terms of cpu us‐
|
||||||
age, which is what (num) represents. The types are: "name",
|
age, which is what (num) represents. The types are: "name",
|
||||||
"pid", "cpu", "mem", "mem_res", "mem_vsize", and "time". There
|
"pid", "cpu", "mem", "mem_res", "mem_vsize", and "time". There
|
||||||
can be a max of 10 processes listed.
|
can be a max of 10 processes listed.
|
||||||
|
|
||||||
|
|
||||||
@ -1714,7 +1715,7 @@ conky(1) conky(1)
|
|||||||
|
|
||||||
|
|
||||||
[1mtop_time type, num[0m
|
[1mtop_time type, num[0m
|
||||||
Same as top, except sorted by total CPU time instead of current
|
Same as top, except sorted by total CPU time instead of current
|
||||||
CPU usage
|
CPU usage
|
||||||
|
|
||||||
|
|
||||||
@ -1736,9 +1737,9 @@ conky(1) conky(1)
|
|||||||
|
|
||||||
[1mupspeedgraph ("normal"|"log") (height),(width) (gradient colour 1)[0m
|
[1mupspeedgraph ("normal"|"log") (height),(width) (gradient colour 1)[0m
|
||||||
[1m(gradient colour 2) (scale) (net)[0m
|
[1m(gradient colour 2) (scale) (net)[0m
|
||||||
Upload speed graph, colours defined in hex, minus the #. If
|
Upload speed graph, colours defined in hex, minus the #. If
|
||||||
scale is non-zero, it becomes the scale for the graph. Uses a
|
scale is non-zero, it becomes the scale for the graph. Uses a
|
||||||
logarithmic scale (to see small numbers) when you use "log" in‐
|
logarithmic scale (to see small numbers) when you use "log" in‐
|
||||||
stead of "normal".
|
stead of "normal".
|
||||||
|
|
||||||
|
|
||||||
@ -1766,12 +1767,12 @@ conky(1) conky(1)
|
|||||||
|
|
||||||
|
|
||||||
[1mvoffset (pixels)[0m
|
[1mvoffset (pixels)[0m
|
||||||
Change vertical offset by N pixels. Negative values will cause
|
Change vertical offset by N pixels. Negative values will cause
|
||||||
text to overlap. See also $offset.
|
text to overlap. See also $offset.
|
||||||
|
|
||||||
|
|
||||||
[1mvoltage_mv (n)[0m
|
[1mvoltage_mv (n)[0m
|
||||||
Returns CPU #n's voltage in mV. CPUs are counted from 1. If
|
Returns CPU #n's voltage in mV. CPUs are counted from 1. If
|
||||||
omitted, the parameter defaults to 1.
|
omitted, the parameter defaults to 1.
|
||||||
|
|
||||||
|
|
||||||
@ -1890,12 +1891,12 @@ conky(1) conky(1)
|
|||||||
|
|
||||||
|
|
||||||
[1mif_xmms2_connected[0m
|
[1mif_xmms2_connected[0m
|
||||||
Display everything between $if_xmms2_connected and the matching
|
Display everything between $if_xmms2_connected and the matching
|
||||||
$endif if xmms2 is running.
|
$endif if xmms2 is running.
|
||||||
|
|
||||||
|
|
||||||
[1meve api_userid api_key character_id[0m
|
[1meve api_userid api_key character_id[0m
|
||||||
Fetches your currently training skill from the Eve Online API
|
Fetches your currently training skill from the Eve Online API
|
||||||
servers (http://www.eve-online.com/) and displays the skill
|
servers (http://www.eve-online.com/) and displays the skill
|
||||||
along with the remaining training time.
|
along with the remaining training time.
|
||||||
|
|
||||||
@ -1914,13 +1915,13 @@ conky(1) conky(1)
|
|||||||
[1mBUGS[0m
|
[1mBUGS[0m
|
||||||
Drawing to root or some other desktop window directly doesn't work with
|
Drawing to root or some other desktop window directly doesn't work with
|
||||||
all window managers. Especially doesn't work well with Gnome and it has
|
all window managers. Especially doesn't work well with Gnome and it has
|
||||||
been reported that it doesn't work with KDE either. Nautilus can be
|
been reported that it doesn't work with KDE either. Nautilus can be
|
||||||
disabled from drawing to desktop with program gconf-editor. Uncheck
|
disabled from drawing to desktop with program gconf-editor. Uncheck
|
||||||
show_desktop in /apps/nautilus/preferences/. There is -w switch in
|
show_desktop in /apps/nautilus/preferences/. There is -w switch in
|
||||||
Conky to set some specific window id. You might find xwininfo -tree
|
Conky to set some specific window id. You might find xwininfo -tree
|
||||||
useful to find the window to draw to. You can also use -o argument
|
useful to find the window to draw to. You can also use -o argument
|
||||||
which makes Conky to create its own window. If you do try running Conky
|
which makes Conky to create its own window. If you do try running Conky
|
||||||
in its own window, be sure to read up on the own_window_type settings
|
in its own window, be sure to read up on the own_window_type settings
|
||||||
and experiment.
|
and experiment.
|
||||||
|
|
||||||
[1mSEE ALSO[0m
|
[1mSEE ALSO[0m
|
||||||
@ -1931,11 +1932,11 @@ conky(1) conky(1)
|
|||||||
#conky on irc.freenode.net
|
#conky on irc.freenode.net
|
||||||
|
|
||||||
[1mCOPYING[0m
|
[1mCOPYING[0m
|
||||||
Copyright (c) 2005-2009 Brenden Matthews, Philip Kovacs, et. al. Any
|
Copyright (c) 2005-2009 Brenden Matthews, Philip Kovacs, et. al. Any
|
||||||
original torsmo code is licensed under the BSD license (see LICENSE.BSD
|
original torsmo code is licensed under the BSD license (see LICENSE.BSD
|
||||||
for a copy). All code written since the fork of torsmo is licensed un‐
|
for a copy). All code written since the fork of torsmo is licensed un‐
|
||||||
der the GPL (see LICENSE.GPL for a copy), except where noted different‐
|
der the GPL (see LICENSE.GPL for a copy), except where noted different‐
|
||||||
ly (such as in portmon code, timed thread code, and audacious code
|
ly (such as in portmon code, timed thread code, and audacious code
|
||||||
which are LGPL, and prss which is an MIT-style license).
|
which are LGPL, and prss which is an MIT-style license).
|
||||||
|
|
||||||
[1mAUTHORS[0m
|
[1mAUTHORS[0m
|
||||||
|
@ -1417,7 +1417,7 @@ Download and parse RSS feeds. Action may be one of the following: feed_title, it
|
|||||||
|
|
||||||
.TP
|
.TP
|
||||||
\fB\*(T<\fBtab\fR\*(T>\fR \*(T<\fB(width, (start))\fR\*(T>
|
\fB\*(T<\fBtab\fR\*(T>\fR \*(T<\fB(width, (start))\fR\*(T>
|
||||||
Puts a tab of the specified width, starting from column 'start'.
|
Puts a tab of the specified width, starting from column 'start'. The unit is pixels for both arguments.
|
||||||
|
|
||||||
.TP
|
.TP
|
||||||
\fB\*(T<\fBtail\fR\*(T>\fR \*(T<\fBlogfile lines (interval)\fR\*(T>
|
\fB\*(T<\fBtail\fR\*(T>\fR \*(T<\fBlogfile lines (interval)\fR\*(T>
|
||||||
|
135
src/conky.c
135
src/conky.c
@ -855,6 +855,7 @@ static void free_text_objects(struct text_object *root)
|
|||||||
case OBJ_execi:
|
case OBJ_execi:
|
||||||
case OBJ_execibar:
|
case OBJ_execibar:
|
||||||
case OBJ_execigraph:
|
case OBJ_execigraph:
|
||||||
|
case OBJ_execigauge:
|
||||||
free(data.execi.cmd);
|
free(data.execi.cmd);
|
||||||
free(data.execi.buffer);
|
free(data.execi.buffer);
|
||||||
break;
|
break;
|
||||||
@ -1411,14 +1412,22 @@ static struct text_object *construct_text_object(const char *s,
|
|||||||
obj->data.s = strndup(arg ? arg : "", text_buffer_size);
|
obj->data.s = strndup(arg ? arg : "", text_buffer_size);
|
||||||
END OBJ(execp, 0)
|
END OBJ(execp, 0)
|
||||||
obj->data.s = strndup(arg ? arg : "", text_buffer_size);
|
obj->data.s = strndup(arg ? arg : "", text_buffer_size);
|
||||||
|
#define SIZE_DEFAULTS(arg) { \
|
||||||
|
obj->a = default_##arg##_width; \
|
||||||
|
obj->b = default_##arg##_height; \
|
||||||
|
}
|
||||||
END OBJ(execgauge, 0)
|
END OBJ(execgauge, 0)
|
||||||
|
SIZE_DEFAULTS(gauge);
|
||||||
obj->data.s = strndup(arg ? arg : "", text_buffer_size);
|
obj->data.s = strndup(arg ? arg : "", text_buffer_size);
|
||||||
END OBJ(execbar, 0)
|
END OBJ(execbar, 0)
|
||||||
|
SIZE_DEFAULTS(bar);
|
||||||
obj->data.s = strndup(arg ? arg : "", text_buffer_size);
|
obj->data.s = strndup(arg ? arg : "", text_buffer_size);
|
||||||
END OBJ(execgraph, 0)
|
END OBJ(execgraph, 0)
|
||||||
|
SIZE_DEFAULTS(graph);
|
||||||
obj->data.s = strndup(arg ? arg : "", text_buffer_size);
|
obj->data.s = strndup(arg ? arg : "", text_buffer_size);
|
||||||
END OBJ(execibar, 0)
|
END OBJ(execibar, 0)
|
||||||
int n;
|
int n;
|
||||||
|
SIZE_DEFAULTS(bar);
|
||||||
|
|
||||||
if (!arg || sscanf(arg, "%f %n", &obj->data.execi.interval, &n) <= 0) {
|
if (!arg || sscanf(arg, "%f %n", &obj->data.execi.interval, &n) <= 0) {
|
||||||
char buf[256];
|
char buf[256];
|
||||||
@ -1432,6 +1441,7 @@ static struct text_object *construct_text_object(const char *s,
|
|||||||
}
|
}
|
||||||
END OBJ(execigraph, 0)
|
END OBJ(execigraph, 0)
|
||||||
int n;
|
int n;
|
||||||
|
SIZE_DEFAULTS(graph);
|
||||||
|
|
||||||
if (!arg || sscanf(arg, "%f %n", &obj->data.execi.interval, &n) <= 0) {
|
if (!arg || sscanf(arg, "%f %n", &obj->data.execi.interval, &n) <= 0) {
|
||||||
char buf[256];
|
char buf[256];
|
||||||
@ -1443,6 +1453,20 @@ static struct text_object *construct_text_object(const char *s,
|
|||||||
} else {
|
} else {
|
||||||
obj->data.execi.cmd = strndup(arg + n, text_buffer_size);
|
obj->data.execi.cmd = strndup(arg + n, text_buffer_size);
|
||||||
}
|
}
|
||||||
|
END OBJ(execigauge, 0)
|
||||||
|
int n;
|
||||||
|
SIZE_DEFAULTS(gauge);
|
||||||
|
|
||||||
|
if (!arg || sscanf(arg, "%f %n", &obj->data.execi.interval, &n) <= 0) {
|
||||||
|
char buf[256];
|
||||||
|
|
||||||
|
ERR("${execigauge <interval> command}");
|
||||||
|
obj->type = OBJ_text;
|
||||||
|
snprintf(buf, 256, "${%s}", s);
|
||||||
|
obj->data.s = strndup(buf, text_buffer_size);
|
||||||
|
} else {
|
||||||
|
obj->data.execi.cmd = strndup(arg + n, text_buffer_size);
|
||||||
|
}
|
||||||
END OBJ(execi, 0)
|
END OBJ(execi, 0)
|
||||||
int n;
|
int n;
|
||||||
|
|
||||||
@ -3020,12 +3044,12 @@ static inline double get_barnum(char *buf)
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (sscanf(buf, "%lf", &barnum) == 0) {
|
if (sscanf(buf, "%lf", &barnum) == 0) {
|
||||||
ERR("reading execbar value failed (perhaps it's not the "
|
ERR("reading exec value failed (perhaps it's not the "
|
||||||
"correct format?)");
|
"correct format?)");
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
if (barnum > 100.0 || barnum < 0.0) {
|
if (barnum > 100.0 || barnum < 0.0) {
|
||||||
ERR("your execbar value is not between 0 and 100, "
|
ERR("your exec value is not between 0 and 100, "
|
||||||
"therefore it will be ignored");
|
"therefore it will be ignored");
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
@ -3192,7 +3216,7 @@ static void generate_text_internal(char *p, int p_max_size,
|
|||||||
}
|
}
|
||||||
OBJ(cpu) {
|
OBJ(cpu) {
|
||||||
if (obj->data.cpu_index > info.cpu_count) {
|
if (obj->data.cpu_index > info.cpu_count) {
|
||||||
printf("obj->data.cpu_index %i info.cpu_count %i",
|
ERR("obj->data.cpu_index %i info.cpu_count %i",
|
||||||
obj->data.cpu_index, info.cpu_count);
|
obj->data.cpu_index, info.cpu_count);
|
||||||
CRIT_ERR("attempting to use more CPUs than you have!");
|
CRIT_ERR("attempting to use more CPUs than you have!");
|
||||||
}
|
}
|
||||||
@ -3549,7 +3573,7 @@ static void generate_text_internal(char *p, int p_max_size,
|
|||||||
|
|
||||||
if (barnum >= 0.0) {
|
if (barnum >= 0.0) {
|
||||||
barnum /= 100;
|
barnum /= 100;
|
||||||
new_bar(p, 0, 6, round_to_int(barnum * 255.0));
|
new_gauge(p, obj->a, obj->b, round_to_int(barnum * 255.0));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
OBJ(execbar) {
|
OBJ(execbar) {
|
||||||
@ -3560,7 +3584,7 @@ static void generate_text_internal(char *p, int p_max_size,
|
|||||||
|
|
||||||
if (barnum >= 0.0) {
|
if (barnum >= 0.0) {
|
||||||
barnum /= 100;
|
barnum /= 100;
|
||||||
new_bar(p, 0, 6, round_to_int(barnum * 255.0));
|
new_bar(p, obj->a, obj->b, round_to_int(barnum * 255.0));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
OBJ(execgraph) {
|
OBJ(execgraph) {
|
||||||
@ -3578,7 +3602,7 @@ static void generate_text_internal(char *p, int p_max_size,
|
|||||||
barnum = get_barnum(p);
|
barnum = get_barnum(p);
|
||||||
|
|
||||||
if (barnum >= 0.0) {
|
if (barnum >= 0.0) {
|
||||||
new_graph(p, 0, 25, obj->c, obj->d, round_to_int(barnum),
|
new_graph(p, obj->a, obj->b, obj->c, obj->d, round_to_int(barnum),
|
||||||
100, 1, showaslog);
|
100, 1, showaslog);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -3595,7 +3619,7 @@ static void generate_text_internal(char *p, int p_max_size,
|
|||||||
}
|
}
|
||||||
obj->data.execi.last_update = current_update_time;
|
obj->data.execi.last_update = current_update_time;
|
||||||
}
|
}
|
||||||
new_bar(p, 0, 6, round_to_int(obj->f));
|
new_bar(p, obj->a, obj->b, round_to_int(obj->f));
|
||||||
}
|
}
|
||||||
OBJ(execigraph) {
|
OBJ(execigraph) {
|
||||||
if (current_update_time - obj->data.execi.last_update
|
if (current_update_time - obj->data.execi.last_update
|
||||||
@ -3610,7 +3634,22 @@ static void generate_text_internal(char *p, int p_max_size,
|
|||||||
}
|
}
|
||||||
obj->data.execi.last_update = current_update_time;
|
obj->data.execi.last_update = current_update_time;
|
||||||
}
|
}
|
||||||
new_graph(p, 0, 25, obj->c, obj->d, (int) (obj->f), 100, 1, FALSE);
|
new_graph(p, obj->a, obj->b, obj->c, obj->d, (int) (obj->f), 100, 1, FALSE);
|
||||||
|
}
|
||||||
|
OBJ(execigauge) {
|
||||||
|
if (current_update_time - obj->data.execi.last_update
|
||||||
|
>= obj->data.execi.interval) {
|
||||||
|
double barnum;
|
||||||
|
|
||||||
|
read_exec(obj->data.execi.cmd, p, text_buffer_size);
|
||||||
|
barnum = get_barnum(p);
|
||||||
|
|
||||||
|
if (barnum >= 0.0) {
|
||||||
|
obj->f = 255 * barnum / 100.0;
|
||||||
|
}
|
||||||
|
obj->data.execi.last_update = current_update_time;
|
||||||
|
}
|
||||||
|
new_gauge(p, obj->a, obj->b, round_to_int(obj->f));
|
||||||
}
|
}
|
||||||
OBJ(execi) {
|
OBJ(execi) {
|
||||||
if (current_update_time - obj->data.execi.last_update
|
if (current_update_time - obj->data.execi.last_update
|
||||||
@ -4940,6 +4979,7 @@ static inline int get_string_width_special(char *s)
|
|||||||
*(p + i) = *(p + i + 1);
|
*(p + i) = *(p + i + 1);
|
||||||
}
|
}
|
||||||
if (specials[special_index + idx].type == GRAPH
|
if (specials[special_index + idx].type == GRAPH
|
||||||
|
|| specials[special_index + idx].type == GAUGE
|
||||||
|| specials[special_index + idx].type == BAR) {
|
|| specials[special_index + idx].type == BAR) {
|
||||||
width += specials[special_index + idx].width;
|
width += specials[special_index + idx].width;
|
||||||
}
|
}
|
||||||
@ -5088,11 +5128,12 @@ static void text_size_updater(char *s)
|
|||||||
*p = SPECIAL_CHAR;
|
*p = SPECIAL_CHAR;
|
||||||
|
|
||||||
if (specials[special_index].type == BAR
|
if (specials[special_index].type == BAR
|
||||||
|
|| specials[special_index].type == GAUGE
|
||||||
|| specials[special_index].type == GRAPH) {
|
|| specials[special_index].type == GRAPH) {
|
||||||
w += specials[special_index].width;
|
w += specials[special_index].width;
|
||||||
if (specials[special_index].height > last_font_height) {
|
if (specials[special_index].height > last_font_height) {
|
||||||
last_font_height = specials[special_index].height;
|
last_font_height = specials[special_index].height;
|
||||||
last_font_height += font_ascent();
|
last_font_height += font_height();
|
||||||
}
|
}
|
||||||
} else if (specials[special_index].type == OFFSET) {
|
} else if (specials[special_index].type == OFFSET) {
|
||||||
if (specials[special_index].arg > 0) {
|
if (specials[special_index].arg > 0) {
|
||||||
@ -5251,7 +5292,7 @@ static void draw_line(char *s)
|
|||||||
#ifdef X11
|
#ifdef X11
|
||||||
char *p;
|
char *p;
|
||||||
int cur_y_add = 0;
|
int cur_y_add = 0;
|
||||||
short font_h;
|
int font_h;
|
||||||
char *tmp_str;
|
char *tmp_str;
|
||||||
#endif /* X11 */
|
#endif /* X11 */
|
||||||
|
|
||||||
@ -5319,7 +5360,7 @@ static void draw_line(char *s)
|
|||||||
bar_usage = specials[special_index].arg;
|
bar_usage = specials[special_index].arg;
|
||||||
by = cur_y - (font_ascent() / 2) - 1;
|
by = cur_y - (font_ascent() / 2) - 1;
|
||||||
|
|
||||||
if (h < font_height()) {
|
if (h < font_h) {
|
||||||
by -= h / 2 - 1;
|
by -= h / 2 - 1;
|
||||||
}
|
}
|
||||||
w = specials[special_index].width;
|
w = specials[special_index].width;
|
||||||
@ -5337,18 +5378,18 @@ static void draw_line(char *s)
|
|||||||
by, w, h);
|
by, w, h);
|
||||||
XFillRectangle(display, window.drawable, window.gc, cur_x,
|
XFillRectangle(display, window.drawable, window.gc, cur_x,
|
||||||
by, w * bar_usage / 255, h);
|
by, w * bar_usage / 255, h);
|
||||||
if (specials[special_index].height > cur_y_add
|
if (h > cur_y_add
|
||||||
&& specials[special_index].height > font_h) {
|
&& h > font_h) {
|
||||||
cur_y_add = specials[special_index].height;
|
cur_y_add = h;
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
case GAUGE: /* new GAUGE */
|
case GAUGE: /* new GAUGE */
|
||||||
{
|
{
|
||||||
int h, by = 0;
|
int h, by = 0;
|
||||||
unsigned long last_colour = current_color;
|
unsigned long last_colour = current_color;
|
||||||
float angle, px,py;
|
float angle, px, py;
|
||||||
int usage;
|
int usage;
|
||||||
|
|
||||||
if (cur_x - text_start_x > maximum_width
|
if (cur_x - text_start_x > maximum_width
|
||||||
@ -5359,7 +5400,7 @@ static void draw_line(char *s)
|
|||||||
h = specials[special_index].height;
|
h = specials[special_index].height;
|
||||||
by = cur_y - (font_ascent() / 2) - 1;
|
by = cur_y - (font_ascent() / 2) - 1;
|
||||||
|
|
||||||
if (h < font_height()) {
|
if (h < font_h) {
|
||||||
by -= h / 2 - 1;
|
by -= h / 2 - 1;
|
||||||
}
|
}
|
||||||
w = specials[special_index].width;
|
w = specials[special_index].width;
|
||||||
@ -5371,24 +5412,24 @@ static void draw_line(char *s)
|
|||||||
}
|
}
|
||||||
|
|
||||||
XSetLineAttributes(display, window.gc, 1, LineSolid,
|
XSetLineAttributes(display, window.gc, 1, LineSolid,
|
||||||
CapButt, JoinMiter);
|
CapButt, JoinMiter);
|
||||||
|
|
||||||
XDrawArc(display, window.drawable, window.gc,
|
XDrawArc(display, window.drawable, window.gc,
|
||||||
cur_x, by, w * 2.0, h * 2.0, 0, 180*64);
|
cur_x, by, w, h * 2, 0, 180*64);
|
||||||
|
|
||||||
#ifdef MATH
|
#ifdef MATH
|
||||||
usage =specials[special_index].arg;
|
usage = specials[special_index].arg;
|
||||||
angle = (3.14)*(float)(usage)/255.;
|
angle = (M_PI)*(float)(usage)/255.;
|
||||||
px = (float)(cur_x+w)-(float)(w)*cos(angle);
|
px = (float)(cur_x+(w/2.))-(float)(w/2.)*cos(angle);
|
||||||
py = (float)(by+h)-(float)(h)*sin(angle);
|
py = (float)(by+(h))-(float)(h)*sin(angle);
|
||||||
|
|
||||||
XDrawLine(display, window.drawable, window.gc,
|
XDrawLine(display, window.drawable, window.gc,
|
||||||
cur_x + w, by+h, (int)(px), (int)(py));
|
cur_x + (w/2.), by+(h), (int)(px), (int)(py));
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
if (specials[special_index].height > cur_y_add
|
if (h > cur_y_add
|
||||||
&& specials[special_index].height > font_h) {
|
&& h > font_h) {
|
||||||
cur_y_add = specials[special_index].height;
|
cur_y_add = h;
|
||||||
}
|
}
|
||||||
|
|
||||||
set_foreground_color(last_colour);
|
set_foreground_color(last_colour);
|
||||||
@ -5412,7 +5453,7 @@ static void draw_line(char *s)
|
|||||||
h = specials[special_index].height;
|
h = specials[special_index].height;
|
||||||
by = cur_y - (font_ascent() / 2) - 1;
|
by = cur_y - (font_ascent() / 2) - 1;
|
||||||
|
|
||||||
if (h < font_height()) {
|
if (h < font_h) {
|
||||||
by -= h / 2 - 1;
|
by -= h / 2 - 1;
|
||||||
}
|
}
|
||||||
w = specials[special_index].width;
|
w = specials[special_index].width;
|
||||||
@ -5461,9 +5502,9 @@ static void draw_line(char *s)
|
|||||||
by + h - specials[special_index].graph[j] *
|
by + h - specials[special_index].graph[j] *
|
||||||
(h - 1) / specials[special_index].graph_scale);
|
(h - 1) / specials[special_index].graph_scale);
|
||||||
}
|
}
|
||||||
if (specials[special_index].height > cur_y_add
|
if (h > cur_y_add
|
||||||
&& specials[special_index].height > font_h) {
|
&& h > font_h) {
|
||||||
cur_y_add = specials[special_index].height;
|
cur_y_add = h;
|
||||||
}
|
}
|
||||||
/* if (draw_mode == BG) {
|
/* if (draw_mode == BG) {
|
||||||
set_foreground_color(default_bg_color);
|
set_foreground_color(default_bg_color);
|
||||||
@ -5481,37 +5522,37 @@ static void draw_line(char *s)
|
|||||||
char *tmp_min_str;
|
char *tmp_min_str;
|
||||||
char *tmp_sec_str;
|
char *tmp_sec_str;
|
||||||
unsigned short int timeunits;
|
unsigned short int timeunits;
|
||||||
if(seconds!=0){
|
if (seconds != 0) {
|
||||||
timeunits = seconds / 86400; seconds %= 86400;
|
timeunits = seconds / 86400; seconds %= 86400;
|
||||||
if( timeunits > 0 ) {
|
if (timeunits > 0) {
|
||||||
asprintf(&tmp_day_str, "%dd", timeunits);
|
asprintf(&tmp_day_str, "%dd", timeunits);
|
||||||
}else{
|
} else {
|
||||||
tmp_day_str = strdup("");
|
tmp_day_str = strdup("");
|
||||||
}
|
}
|
||||||
timeunits = seconds / 3600; seconds %= 3600;
|
timeunits = seconds / 3600; seconds %= 3600;
|
||||||
if( timeunits > 0 ) {
|
if (timeunits > 0) {
|
||||||
asprintf(&tmp_hour_str, "%dh", timeunits);
|
asprintf(&tmp_hour_str, "%dh", timeunits);
|
||||||
}else{
|
} else {
|
||||||
tmp_hour_str = strdup("");
|
tmp_hour_str = strdup("");
|
||||||
}
|
}
|
||||||
timeunits = seconds / 60; seconds %= 60;
|
timeunits = seconds / 60; seconds %= 60;
|
||||||
if(timeunits > 0) {
|
if (timeunits > 0) {
|
||||||
asprintf(&tmp_min_str, "%dm", timeunits);
|
asprintf(&tmp_min_str, "%dm", timeunits);
|
||||||
}else{
|
} else {
|
||||||
tmp_min_str = strdup("");
|
tmp_min_str = strdup("");
|
||||||
}
|
}
|
||||||
if(seconds > 0) {
|
if (seconds > 0) {
|
||||||
asprintf(&tmp_sec_str, "%ds", seconds);
|
asprintf(&tmp_sec_str, "%ds", seconds);
|
||||||
}else{
|
} else {
|
||||||
tmp_sec_str = strdup("");
|
tmp_sec_str = strdup("");
|
||||||
}
|
}
|
||||||
asprintf(&tmp_str, "%s%s%s%s", tmp_day_str, tmp_hour_str, tmp_min_str, tmp_sec_str);
|
asprintf(&tmp_str, "%s%s%s%s", tmp_day_str, tmp_hour_str, tmp_min_str, tmp_sec_str);
|
||||||
free(tmp_day_str); free(tmp_hour_str); free(tmp_min_str); free(tmp_sec_str);
|
free(tmp_day_str); free(tmp_hour_str); free(tmp_min_str); free(tmp_sec_str);
|
||||||
}else{
|
} else {
|
||||||
asprintf(&tmp_str, "Range not possible"); //should never happen, but better safe then sorry
|
asprintf(&tmp_str, "Range not possible"); // should never happen, but better safe then sorry
|
||||||
}
|
}
|
||||||
cur_x += (w / 2) - (font_ascent() * (strlen(tmp_str) / 2));
|
cur_x += (w / 2) - (font_ascent() * (strlen(tmp_str) / 2));
|
||||||
cur_y += font_height() / 2;
|
cur_y += font_h / 2;
|
||||||
draw_string(tmp_str);
|
draw_string(tmp_str);
|
||||||
free(tmp_str);
|
free(tmp_str);
|
||||||
cur_x = tmp_x;
|
cur_x = tmp_x;
|
||||||
@ -5522,7 +5563,7 @@ static void draw_line(char *s)
|
|||||||
int tmp_x = cur_x;
|
int tmp_x = cur_x;
|
||||||
int tmp_y = cur_y;
|
int tmp_y = cur_y;
|
||||||
cur_x += font_ascent() / 2;
|
cur_x += font_ascent() / 2;
|
||||||
cur_y += font_height() / 2;
|
cur_y += font_h / 2;
|
||||||
tmp_str = (char *)
|
tmp_str = (char *)
|
||||||
calloc(log10(floor(specials[special_index].graph_scale)) + 4,
|
calloc(log10(floor(specials[special_index].graph_scale)) + 4,
|
||||||
sizeof(char));
|
sizeof(char));
|
||||||
@ -5549,6 +5590,7 @@ static void draw_line(char *s)
|
|||||||
cur_y += font_ascent();
|
cur_y += font_ascent();
|
||||||
}
|
}
|
||||||
set_font();
|
set_font();
|
||||||
|
font_h = font_height();
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
case FG:
|
case FG:
|
||||||
@ -5641,14 +5683,13 @@ static void draw_line(char *s)
|
|||||||
|
|
||||||
p++;
|
p++;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (cur_y_add > 0) {
|
if (cur_y_add > 0) {
|
||||||
cur_y += cur_y_add;
|
cur_y += cur_y_add;
|
||||||
cur_y -= font_descent();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
draw_string(s);
|
draw_string(s);
|
||||||
|
|
||||||
cur_y += font_descent();
|
cur_y += font_descent();
|
||||||
|
|
||||||
#endif /* X11 */
|
#endif /* X11 */
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -43,8 +43,8 @@ struct special_t *specials = NULL;
|
|||||||
unsigned int special_count;
|
unsigned int special_count;
|
||||||
|
|
||||||
int default_bar_width = 0, default_bar_height = 6;
|
int default_bar_width = 0, default_bar_height = 6;
|
||||||
int default_graph_width = 25, default_graph_height = 25;
|
int default_graph_width = 0, default_graph_height = 25;
|
||||||
int default_gauge_width = 0, default_gauge_height = 25;
|
int default_gauge_width = 50, default_gauge_height = 25;
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Scanning arguments to various special text objects
|
* Scanning arguments to various special text objects
|
||||||
|
@ -6,7 +6,6 @@
|
|||||||
*
|
*
|
||||||
* Please see COPYING for details
|
* Please see COPYING for details
|
||||||
*
|
*
|
||||||
* Copyright (c) 2004, Hannu Saransaari and Lauri Hakkarainen
|
|
||||||
* Copyright (c) 2005-2009 Brenden Matthews, Philip Kovacs, et. al.
|
* Copyright (c) 2005-2009 Brenden Matthews, Philip Kovacs, et. al.
|
||||||
* (see AUTHORS)
|
* (see AUTHORS)
|
||||||
* All rights reserved.
|
* All rights reserved.
|
||||||
|
@ -101,6 +101,7 @@ enum text_object_type {
|
|||||||
OBJ_execgraph,
|
OBJ_execgraph,
|
||||||
OBJ_execibar,
|
OBJ_execibar,
|
||||||
OBJ_execigraph,
|
OBJ_execigraph,
|
||||||
|
OBJ_execigauge,
|
||||||
OBJ_execp,
|
OBJ_execp,
|
||||||
OBJ_execpi,
|
OBJ_execpi,
|
||||||
OBJ_freq,
|
OBJ_freq,
|
||||||
|
Loading…
Reference in New Issue
Block a user