mirror of
https://github.com/Llewellynvdm/conky.git
synced 2024-12-25 04:06:03 +00:00
convert memperc to callbacks.percentage
This commit is contained in:
parent
07f82f5cb6
commit
feba298efa
@ -487,6 +487,13 @@ uint8_t cpu_barval(struct text_object *obj)
|
||||
return round_to_int(info.cpu_usage[obj->data.i] * 255.0);
|
||||
}
|
||||
|
||||
uint8_t mem_percentage(struct text_object *obj)
|
||||
{
|
||||
(void)obj;
|
||||
|
||||
return (info.memmax ? round_to_int(info.mem * 100 / info.memmax) : 0);
|
||||
}
|
||||
|
||||
uint8_t mem_barval(struct text_object *obj)
|
||||
{
|
||||
(void)obj;
|
||||
|
@ -77,6 +77,7 @@ uint8_t loadgraphval(struct text_object *);
|
||||
|
||||
uint8_t cpu_percentage(struct text_object *);
|
||||
uint8_t cpu_barval(struct text_object *);
|
||||
uint8_t mem_percentage(struct text_object *);
|
||||
uint8_t mem_barval(struct text_object *);
|
||||
uint8_t swap_barval(struct text_object *);
|
||||
|
||||
|
@ -976,10 +976,6 @@ void generate_text_internal(char *p, int p_max_size,
|
||||
OBJ(memmax) {
|
||||
human_readable(cur->memmax * 1024, p, 255);
|
||||
}
|
||||
OBJ(memperc) {
|
||||
if (cur->memmax)
|
||||
percent_print(p, p_max_size, cur->mem * 100 / cur->memmax);
|
||||
}
|
||||
#ifdef X11
|
||||
#define NOT_IN_X "Not running in X"
|
||||
OBJ(monitor) {
|
||||
|
@ -769,6 +769,7 @@ struct text_object *construct_text_object(const char *s, const char *arg, long
|
||||
END OBJ(memfree, &update_meminfo)
|
||||
END OBJ(memmax, &update_meminfo)
|
||||
END OBJ(memperc, &update_meminfo)
|
||||
obj->callbacks.percentage = &mem_percentage;
|
||||
END OBJ(memgauge, &update_meminfo)
|
||||
scan_gauge(obj, arg);
|
||||
obj->callbacks.gaugeval = &mem_barval;
|
||||
|
Loading…
Reference in New Issue
Block a user