1
0
mirror of https://github.com/Llewellynvdm/conky.git synced 2024-12-25 04:06:03 +00:00

convert cpubar to callbacks.barval

This commit is contained in:
Phil Sutter 2009-11-22 18:02:56 +01:00
parent 06a4650f60
commit c85295202b
4 changed files with 9 additions and 3 deletions

View File

@ -472,3 +472,8 @@ void print_loadgraph(struct text_object *obj, char *p, int p_max_size)
new_graph(obj, p, p_max_size, info.loadavg[0]);
}
#endif /* X11 */
uint8_t cpu_barval(struct text_object *obj)
{
return (uint8_t)(info.cpu_usage[obj->data.i] * 255.0);
}

View File

@ -75,4 +75,6 @@ void scan_loadgraph_arg(struct text_object *, const char *);
void print_loadgraph(struct text_object *, char *, int);
#endif /* X11 */
uint8_t cpu_barval(struct text_object *);
#endif /* _COMMON_H */

View File

@ -886,10 +886,8 @@ void generate_text_internal(char *p, int p_max_size,
percent_print(p, p_max_size,
round_to_int(cur->cpu_usage[obj->data.i] * 100.0));
}
OBJ(cpugauge)
OBJ(cpugauge) {
new_gauge(obj, p, p_max_size, round_to_int(cur->cpu_usage[obj->data.i] * 255.0));
OBJ(cpubar) {
new_bar(obj, p, p_max_size, round_to_int(cur->cpu_usage[obj->data.i] * 255.0));
}
#ifdef X11
OBJ(cpugraph) {

View File

@ -393,6 +393,7 @@ struct text_object *construct_text_object(const char *s, const char *arg, long
END OBJ(cpubar, &update_cpu_usage)
SCAN_CPU(arg, obj->data.i);
scan_bar(obj, arg);
obj->callbacks.barval = &cpu_barval;
DBGP2("Adding $cpubar for CPU %d", obj->data.i);
#ifdef X11
END OBJ(cpugraph, &update_cpu_usage)