mirror of
https://github.com/Llewellynvdm/conky.git
synced 2024-11-18 11:05:18 +00:00
convert swapbar to callbacks
This commit is contained in:
parent
d2f3ae7e15
commit
086829b017
@ -484,3 +484,10 @@ uint8_t mem_barval(struct text_object *obj)
|
||||
|
||||
return round_to_int(info.memmax ? (info.mem * 255 / info.memmax) : 0);
|
||||
}
|
||||
|
||||
uint8_t swap_barval(struct text_object *obj)
|
||||
{
|
||||
(void)obj;
|
||||
|
||||
return round_to_int(info.swapmax ? (info.swap * 255 / info.swapmax) : 0);
|
||||
}
|
||||
|
@ -77,5 +77,6 @@ void print_loadgraph(struct text_object *, char *, int);
|
||||
|
||||
uint8_t cpu_barval(struct text_object *);
|
||||
uint8_t mem_barval(struct text_object *);
|
||||
uint8_t swap_barval(struct text_object *);
|
||||
|
||||
#endif /* _COMMON_H */
|
||||
|
@ -1357,9 +1357,6 @@ void generate_text_internal(char *p, int p_max_size,
|
||||
percent_print(p, p_max_size, cur->swap * 100 / cur->swapmax);
|
||||
}
|
||||
}
|
||||
OBJ(swapbar) {
|
||||
new_bar(obj, p, p_max_size, cur->swapmax ? (cur->swap * 255) / (cur->swapmax) : 0);
|
||||
}
|
||||
OBJ(sysname) {
|
||||
snprintf(p, p_max_size, "%s", cur->uname_s.sysname);
|
||||
}
|
||||
|
@ -970,6 +970,8 @@ struct text_object *construct_text_object(const char *s, const char *arg, long
|
||||
END OBJ(swapperc, &update_meminfo)
|
||||
END OBJ(swapbar, &update_meminfo)
|
||||
scan_bar(obj, arg);
|
||||
obj->callbacks.barval = &swap_barval;
|
||||
/* XXX: swapgraph, swapgauge? */
|
||||
END OBJ(sysname, 0)
|
||||
END OBJ(time, 0)
|
||||
scan_time(obj, arg);
|
||||
|
Loading…
Reference in New Issue
Block a user