mirror of
https://github.com/Llewellynvdm/conky.git
synced 2024-06-02 07:20:47 +00:00
Replace BUILD_X11 ifdef by BUILD_GUI when it makes sense
This commit is contained in:
parent
c965ea7d00
commit
4ffd09be1e
|
@ -350,7 +350,7 @@ void print_no_update(struct text_object *obj, char *p,
|
||||||
snprintf(p, p_max_size, "%s", obj->data.s);
|
snprintf(p, p_max_size, "%s", obj->data.s);
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifdef BUILD_X11
|
#ifdef BUILD_GUI
|
||||||
void scan_loadgraph_arg(struct text_object *obj, const char *arg) {
|
void scan_loadgraph_arg(struct text_object *obj, const char *arg) {
|
||||||
char *buf = nullptr;
|
char *buf = nullptr;
|
||||||
|
|
||||||
|
@ -363,7 +363,7 @@ double loadgraphval(struct text_object *obj) {
|
||||||
|
|
||||||
return info.loadavg[0];
|
return info.loadavg[0];
|
||||||
}
|
}
|
||||||
#endif /* BUILD_X11 */
|
#endif /* BUILD_GUI */
|
||||||
|
|
||||||
uint8_t cpu_percentage(struct text_object *obj) {
|
uint8_t cpu_percentage(struct text_object *obj) {
|
||||||
if (static_cast<unsigned int>(obj->data.i) > info.cpu_count) {
|
if (static_cast<unsigned int>(obj->data.i) > info.cpu_count) {
|
||||||
|
|
|
@ -94,10 +94,10 @@ void free_no_update(struct text_object *);
|
||||||
|
|
||||||
void scan_loadavg_arg(struct text_object *, const char *);
|
void scan_loadavg_arg(struct text_object *, const char *);
|
||||||
void print_loadavg(struct text_object *, char *, unsigned int);
|
void print_loadavg(struct text_object *, char *, unsigned int);
|
||||||
#ifdef BUILD_X11
|
#ifdef BUILD_GUI
|
||||||
void scan_loadgraph_arg(struct text_object *, const char *);
|
void scan_loadgraph_arg(struct text_object *, const char *);
|
||||||
double loadgraphval(struct text_object *);
|
double loadgraphval(struct text_object *);
|
||||||
#endif /* BUILD_X11 */
|
#endif /* BUILD_GUI */
|
||||||
|
|
||||||
uint8_t cpu_percentage(struct text_object *);
|
uint8_t cpu_percentage(struct text_object *);
|
||||||
double cpu_barval(struct text_object *);
|
double cpu_barval(struct text_object *);
|
||||||
|
|
86
src/core.cc
86
src/core.cc
|
@ -53,9 +53,9 @@
|
||||||
#ifdef BUILD_IRC
|
#ifdef BUILD_IRC
|
||||||
#include "irc.h"
|
#include "irc.h"
|
||||||
#endif /* BUILD_IRC */
|
#endif /* BUILD_IRC */
|
||||||
#ifdef BUILD_X11
|
#ifdef BUILD_GUI
|
||||||
#include "fonts.h"
|
#include "fonts.h"
|
||||||
#endif /* BUILD_X11 */
|
#endif /* BUILD_GUI */
|
||||||
#include "fs.h"
|
#include "fs.h"
|
||||||
#ifdef BUILD_IBM
|
#ifdef BUILD_IBM
|
||||||
#include "ibm.h"
|
#include "ibm.h"
|
||||||
|
@ -403,12 +403,12 @@ struct text_object *construct_text_object(char *s, const char *arg, long line,
|
||||||
} \
|
} \
|
||||||
else
|
else
|
||||||
|
|
||||||
#ifdef BUILD_X11
|
#ifdef BUILD_GUI
|
||||||
if (s[0] == '#') {
|
if (s[0] == '#') {
|
||||||
obj->data.l = get_x11_color(s);
|
obj->data.l = get_x11_color(s);
|
||||||
obj->callbacks.print = &new_fg;
|
obj->callbacks.print = &new_fg;
|
||||||
} else
|
} else
|
||||||
#endif /* BUILD_X11 */
|
#endif /* BUILD_GUI */
|
||||||
#ifndef __OpenBSD__
|
#ifndef __OpenBSD__
|
||||||
OBJ(acpitemp, nullptr)
|
OBJ(acpitemp, nullptr)
|
||||||
obj->data.i = open_acpi_temperature(arg);
|
obj->data.i = open_acpi_temperature(arg);
|
||||||
|
@ -687,7 +687,7 @@ struct text_object *construct_text_object(char *s, const char *arg, long line,
|
||||||
obj->callbacks.percentage = &cpu_percentage;
|
obj->callbacks.percentage = &cpu_percentage;
|
||||||
obj->callbacks.free = &free_cpu;
|
obj->callbacks.free = &free_cpu;
|
||||||
DBGP2("Adding $cpu for CPU %d", obj->data.i);
|
DBGP2("Adding $cpu for CPU %d", obj->data.i);
|
||||||
#ifdef BUILD_X11
|
#ifdef BUILD_GUI
|
||||||
END OBJ(cpugauge, &update_cpu_usage) get_cpu_count();
|
END OBJ(cpugauge, &update_cpu_usage) get_cpu_count();
|
||||||
SCAN_CPU(arg, obj->data.i);
|
SCAN_CPU(arg, obj->data.i);
|
||||||
scan_gauge(obj, arg, 1);
|
scan_gauge(obj, arg, 1);
|
||||||
|
@ -701,7 +701,7 @@ struct text_object *construct_text_object(char *s, const char *arg, long line,
|
||||||
obj->callbacks.barval = &cpu_barval;
|
obj->callbacks.barval = &cpu_barval;
|
||||||
obj->callbacks.free = &free_cpu;
|
obj->callbacks.free = &free_cpu;
|
||||||
DBGP2("Adding $cpubar for CPU %d", obj->data.i);
|
DBGP2("Adding $cpubar for CPU %d", obj->data.i);
|
||||||
#ifdef BUILD_X11
|
#ifdef BUILD_GUI
|
||||||
END OBJ(cpugraph, &update_cpu_usage) get_cpu_count();
|
END OBJ(cpugraph, &update_cpu_usage) get_cpu_count();
|
||||||
char *buf = nullptr;
|
char *buf = nullptr;
|
||||||
SCAN_CPU(arg, obj->data.i);
|
SCAN_CPU(arg, obj->data.i);
|
||||||
|
@ -712,29 +712,29 @@ struct text_object *construct_text_object(char *s, const char *arg, long line,
|
||||||
obj->callbacks.free = &free_cpu;
|
obj->callbacks.free = &free_cpu;
|
||||||
END OBJ(loadgraph, &update_load_average) scan_loadgraph_arg(obj, arg);
|
END OBJ(loadgraph, &update_load_average) scan_loadgraph_arg(obj, arg);
|
||||||
obj->callbacks.graphval = &loadgraphval;
|
obj->callbacks.graphval = &loadgraphval;
|
||||||
#endif /* BUILD_X11 */
|
#endif /* BUILD_GUI */
|
||||||
END OBJ(diskio, &update_diskio) parse_diskio_arg(obj, arg);
|
END OBJ(diskio, &update_diskio) parse_diskio_arg(obj, arg);
|
||||||
obj->callbacks.print = &print_diskio;
|
obj->callbacks.print = &print_diskio;
|
||||||
END OBJ(diskio_read, &update_diskio) parse_diskio_arg(obj, arg);
|
END OBJ(diskio_read, &update_diskio) parse_diskio_arg(obj, arg);
|
||||||
obj->callbacks.print = &print_diskio_read;
|
obj->callbacks.print = &print_diskio_read;
|
||||||
END OBJ(diskio_write, &update_diskio) parse_diskio_arg(obj, arg);
|
END OBJ(diskio_write, &update_diskio) parse_diskio_arg(obj, arg);
|
||||||
obj->callbacks.print = &print_diskio_write;
|
obj->callbacks.print = &print_diskio_write;
|
||||||
#ifdef BUILD_X11
|
#ifdef BUILD_GUI
|
||||||
END OBJ(diskiograph, &update_diskio) parse_diskiograph_arg(obj, arg);
|
END OBJ(diskiograph, &update_diskio) parse_diskiograph_arg(obj, arg);
|
||||||
obj->callbacks.graphval = &diskiographval;
|
obj->callbacks.graphval = &diskiographval;
|
||||||
END OBJ(diskiograph_read, &update_diskio) parse_diskiograph_arg(obj, arg);
|
END OBJ(diskiograph_read, &update_diskio) parse_diskiograph_arg(obj, arg);
|
||||||
obj->callbacks.graphval = &diskiographval_read;
|
obj->callbacks.graphval = &diskiographval_read;
|
||||||
END OBJ(diskiograph_write, &update_diskio) parse_diskiograph_arg(obj, arg);
|
END OBJ(diskiograph_write, &update_diskio) parse_diskiograph_arg(obj, arg);
|
||||||
obj->callbacks.graphval = &diskiographval_write;
|
obj->callbacks.graphval = &diskiographval_write;
|
||||||
#endif /* BUILD_X11 */
|
#endif /* BUILD_GUI */
|
||||||
END OBJ(color, nullptr)
|
END OBJ(color, nullptr)
|
||||||
#ifdef BUILD_X11
|
#ifdef BUILD_GUI
|
||||||
if (out_to_x.get(*state)) {
|
if (out_to_x.get(*state)) {
|
||||||
obj->data.l =
|
obj->data.l =
|
||||||
arg != nullptr ? get_x11_color(arg) : default_color.get(*state);
|
arg != nullptr ? get_x11_color(arg) : default_color.get(*state);
|
||||||
set_current_text_color(obj->data.l);
|
set_current_text_color(obj->data.l);
|
||||||
}
|
}
|
||||||
#endif /* BUILD_X11 */
|
#endif /* BUILD_GUI */
|
||||||
#ifdef BUILD_NCURSES
|
#ifdef BUILD_NCURSES
|
||||||
if (out_to_ncurses.get(*state)) {
|
if (out_to_ncurses.get(*state)) {
|
||||||
obj->data.l = COLOR_WHITE;
|
obj->data.l = COLOR_WHITE;
|
||||||
|
@ -760,7 +760,7 @@ struct text_object *construct_text_object(char *s, const char *arg, long line,
|
||||||
}
|
}
|
||||||
#endif /* BUILD_NCURSES */
|
#endif /* BUILD_NCURSES */
|
||||||
obj->callbacks.print = &new_fg;
|
obj->callbacks.print = &new_fg;
|
||||||
#ifdef BUILD_X11
|
#ifdef BUILD_GUI
|
||||||
END OBJ(color0, nullptr) obj->data.l = color[0].get(*state);
|
END OBJ(color0, nullptr) obj->data.l = color[0].get(*state);
|
||||||
set_current_text_color(obj->data.l);
|
set_current_text_color(obj->data.l);
|
||||||
obj->callbacks.print = &new_fg;
|
obj->callbacks.print = &new_fg;
|
||||||
|
@ -824,7 +824,7 @@ struct text_object *construct_text_object(char *s, const char *arg, long line,
|
||||||
END OBJ(font9, nullptr) scan_font(obj, font_template[9].get(*state).c_str());
|
END OBJ(font9, nullptr) scan_font(obj, font_template[9].get(*state).c_str());
|
||||||
obj->callbacks.print = &new_font;
|
obj->callbacks.print = &new_font;
|
||||||
obj->callbacks.free = &gen_free_opaque;
|
obj->callbacks.free = &gen_free_opaque;
|
||||||
#endif /* BUILD_X11 */
|
#endif /* BUILD_GUI */
|
||||||
END OBJ(conky_version, nullptr) obj_be_plain_text(obj, VERSION);
|
END OBJ(conky_version, nullptr) obj_be_plain_text(obj, VERSION);
|
||||||
END OBJ(conky_build_date, nullptr) obj_be_plain_text(obj, BUILD_DATE);
|
END OBJ(conky_build_date, nullptr) obj_be_plain_text(obj, BUILD_DATE);
|
||||||
END OBJ(conky_build_arch, nullptr) obj_be_plain_text(obj, BUILD_ARCH);
|
END OBJ(conky_build_arch, nullptr) obj_be_plain_text(obj, BUILD_ARCH);
|
||||||
|
@ -834,11 +834,11 @@ struct text_object *construct_text_object(char *s, const char *arg, long line,
|
||||||
END OBJ(downspeedf, &update_net_stats)
|
END OBJ(downspeedf, &update_net_stats)
|
||||||
parse_net_stat_arg(obj, arg, free_at_crash);
|
parse_net_stat_arg(obj, arg, free_at_crash);
|
||||||
obj->callbacks.print = &print_downspeedf;
|
obj->callbacks.print = &print_downspeedf;
|
||||||
#ifdef BUILD_X11
|
#ifdef BUILD_GUI
|
||||||
END OBJ(downspeedgraph, &update_net_stats)
|
END OBJ(downspeedgraph, &update_net_stats)
|
||||||
parse_net_stat_graph_arg(obj, arg, free_at_crash);
|
parse_net_stat_graph_arg(obj, arg, free_at_crash);
|
||||||
obj->callbacks.graphval = &downspeedgraphval;
|
obj->callbacks.graphval = &downspeedgraphval;
|
||||||
#endif /* BUILD_X11 */
|
#endif /* BUILD_GUI */
|
||||||
END OBJ(else, nullptr) obj_be_ifblock_else(ifblock_opaque, obj);
|
END OBJ(else, nullptr) obj_be_ifblock_else(ifblock_opaque, obj);
|
||||||
obj->callbacks.iftest = &gen_false_iftest;
|
obj->callbacks.iftest = &gen_false_iftest;
|
||||||
END OBJ(endif, nullptr) obj_be_ifblock_endif(ifblock_opaque, obj);
|
END OBJ(endif, nullptr) obj_be_ifblock_endif(ifblock_opaque, obj);
|
||||||
|
@ -846,7 +846,7 @@ struct text_object *construct_text_object(char *s, const char *arg, long line,
|
||||||
END OBJ(eval, nullptr) obj->data.s = STRNDUP_ARG;
|
END OBJ(eval, nullptr) obj->data.s = STRNDUP_ARG;
|
||||||
obj->callbacks.print = &print_evaluate;
|
obj->callbacks.print = &print_evaluate;
|
||||||
obj->callbacks.free = &gen_free_opaque;
|
obj->callbacks.free = &gen_free_opaque;
|
||||||
#if defined(BUILD_IMLIB2) && defined(BUILD_X11)
|
#if defined(BUILD_IMLIB2) && defined(BUILD_GUI)
|
||||||
END OBJ(image, nullptr) obj->data.s = STRNDUP_ARG;
|
END OBJ(image, nullptr) obj->data.s = STRNDUP_ARG;
|
||||||
obj->callbacks.print = &print_image_callback;
|
obj->callbacks.print = &print_image_callback;
|
||||||
obj->callbacks.free = &gen_free_opaque;
|
obj->callbacks.free = &gen_free_opaque;
|
||||||
|
@ -863,13 +863,13 @@ struct text_object *construct_text_object(char *s, const char *arg, long line,
|
||||||
obj->callbacks.print = &print_cat;
|
obj->callbacks.print = &print_cat;
|
||||||
obj->callbacks.free = &gen_free_opaque;
|
obj->callbacks.free = &gen_free_opaque;
|
||||||
|
|
||||||
#ifdef BUILD_X11
|
#ifdef BUILD_GUI
|
||||||
END OBJ(key_num_lock, 0) obj->callbacks.print = &print_key_num_lock;
|
END OBJ(key_num_lock, 0) obj->callbacks.print = &print_key_num_lock;
|
||||||
END OBJ(key_caps_lock, 0) obj->callbacks.print = &print_key_caps_lock;
|
END OBJ(key_caps_lock, 0) obj->callbacks.print = &print_key_caps_lock;
|
||||||
END OBJ(key_scroll_lock, 0) obj->callbacks.print = &print_key_scroll_lock;
|
END OBJ(key_scroll_lock, 0) obj->callbacks.print = &print_key_scroll_lock;
|
||||||
END OBJ(keyboard_layout, 0) obj->callbacks.print = &print_keyboard_layout;
|
END OBJ(keyboard_layout, 0) obj->callbacks.print = &print_keyboard_layout;
|
||||||
END OBJ(mouse_speed, 0) obj->callbacks.print = &print_mouse_speed;
|
END OBJ(mouse_speed, 0) obj->callbacks.print = &print_mouse_speed;
|
||||||
#endif /* BUILD_X11 */
|
#endif /* BUILD_GUI */
|
||||||
|
|
||||||
#ifdef __FreeBSD__
|
#ifdef __FreeBSD__
|
||||||
END OBJ(sysctlbyname, 0) obj->data.s = STRNDUP_ARG;
|
END OBJ(sysctlbyname, 0) obj->data.s = STRNDUP_ARG;
|
||||||
|
@ -944,7 +944,7 @@ struct text_object *construct_text_object(char *s, const char *arg, long line,
|
||||||
register_execi(obj);
|
register_execi(obj);
|
||||||
obj->callbacks.barval = &execbarval;
|
obj->callbacks.barval = &execbarval;
|
||||||
obj->callbacks.free = &free_execi;
|
obj->callbacks.free = &free_execi;
|
||||||
#ifdef BUILD_X11
|
#ifdef BUILD_GUI
|
||||||
END OBJ_ARG(execgauge, nullptr,
|
END OBJ_ARG(execgauge, nullptr,
|
||||||
"execgauge needs arguments: [height],[width] <command>")
|
"execgauge needs arguments: [height],[width] <command>")
|
||||||
scan_exec_arg(obj, arg, EF_EXEC | EF_GAUGE);
|
scan_exec_arg(obj, arg, EF_EXEC | EF_GAUGE);
|
||||||
|
@ -972,7 +972,7 @@ struct text_object *construct_text_object(char *s, const char *arg, long line,
|
||||||
register_execi(obj);
|
register_execi(obj);
|
||||||
obj->callbacks.graphval = &execbarval;
|
obj->callbacks.graphval = &execbarval;
|
||||||
obj->callbacks.free = &free_execi;
|
obj->callbacks.free = &free_execi;
|
||||||
#endif /* BUILD_X11 */
|
#endif /* BUILD_GUI */
|
||||||
END OBJ_ARG(texeci, nullptr, "texeci needs arguments: <interval> <command>")
|
END OBJ_ARG(texeci, nullptr, "texeci needs arguments: <interval> <command>")
|
||||||
scan_exec_arg(obj, arg, EF_EXECI);
|
scan_exec_arg(obj, arg, EF_EXECI);
|
||||||
obj->parse = false;
|
obj->parse = false;
|
||||||
|
@ -1003,10 +1003,10 @@ struct text_object *construct_text_object(char *s, const char *arg, long line,
|
||||||
obj->callbacks.print = &print_fs_type;
|
obj->callbacks.print = &print_fs_type;
|
||||||
END OBJ(fs_used, &update_fs_stats) init_fs(obj, arg);
|
END OBJ(fs_used, &update_fs_stats) init_fs(obj, arg);
|
||||||
obj->callbacks.print = &print_fs_used;
|
obj->callbacks.print = &print_fs_used;
|
||||||
#ifdef BUILD_X11
|
#ifdef BUILD_GUI
|
||||||
END OBJ(hr, nullptr) obj->data.l = arg != nullptr ? atoi(arg) : 1;
|
END OBJ(hr, nullptr) obj->data.l = arg != nullptr ? atoi(arg) : 1;
|
||||||
obj->callbacks.print = &new_hr;
|
obj->callbacks.print = &new_hr;
|
||||||
#endif /* BUILD_X11 */
|
#endif /* BUILD_GUI */
|
||||||
END OBJ(nameserver, &update_dns_data) parse_nameserver_arg(obj, arg);
|
END OBJ(nameserver, &update_dns_data) parse_nameserver_arg(obj, arg);
|
||||||
obj->callbacks.print = &print_nameserver;
|
obj->callbacks.print = &print_nameserver;
|
||||||
obj->callbacks.free = &free_dns_data;
|
obj->callbacks.free = &free_dns_data;
|
||||||
|
@ -1019,10 +1019,10 @@ struct text_object *construct_text_object(char *s, const char *arg, long line,
|
||||||
obj->callbacks.print = &new_save_coordinates;
|
obj->callbacks.print = &new_save_coordinates;
|
||||||
END OBJ_ARG(goto, nullptr, "goto needs arguments") obj->data.l = atoi(arg);
|
END OBJ_ARG(goto, nullptr, "goto needs arguments") obj->data.l = atoi(arg);
|
||||||
obj->callbacks.print = &new_goto;
|
obj->callbacks.print = &new_goto;
|
||||||
#ifdef BUILD_X11
|
#ifdef BUILD_GUI
|
||||||
END OBJ(tab, nullptr) scan_tab(obj, arg);
|
END OBJ(tab, nullptr) scan_tab(obj, arg);
|
||||||
obj->callbacks.print = &new_tab;
|
obj->callbacks.print = &new_tab;
|
||||||
#endif /* BUILD_X11 */
|
#endif /* BUILD_GUI */
|
||||||
#ifdef __linux__
|
#ifdef __linux__
|
||||||
END OBJ_ARG(i2c, 0, "i2c needs arguments") parse_i2c_sensor(obj, arg);
|
END OBJ_ARG(i2c, 0, "i2c needs arguments") parse_i2c_sensor(obj, arg);
|
||||||
obj->callbacks.print = &print_sysfs_sensor;
|
obj->callbacks.print = &print_sysfs_sensor;
|
||||||
|
@ -1193,15 +1193,15 @@ struct text_object *construct_text_object(char *s, const char *arg, long line,
|
||||||
obj->callbacks.print = &print_memdirty;
|
obj->callbacks.print = &print_memdirty;
|
||||||
obj->callbacks.free = &gen_free_opaque;
|
obj->callbacks.free = &gen_free_opaque;
|
||||||
#endif /* __linux__ */
|
#endif /* __linux__ */
|
||||||
#ifdef BUILD_X11
|
#ifdef BUILD_GUI
|
||||||
END OBJ(memgauge, &update_meminfo) scan_gauge(obj, arg, 1);
|
END OBJ(memgauge, &update_meminfo) scan_gauge(obj, arg, 1);
|
||||||
obj->callbacks.gaugeval = &mem_barval;
|
obj->callbacks.gaugeval = &mem_barval;
|
||||||
#endif /* BUILD_X11 */
|
#endif /* BUILD_GUI */
|
||||||
END OBJ(membar, &update_meminfo) scan_bar(obj, arg, 1);
|
END OBJ(membar, &update_meminfo) scan_bar(obj, arg, 1);
|
||||||
obj->callbacks.barval = &mem_barval;
|
obj->callbacks.barval = &mem_barval;
|
||||||
END OBJ(memwithbuffersbar, &update_meminfo) scan_bar(obj, arg, 1);
|
END OBJ(memwithbuffersbar, &update_meminfo) scan_bar(obj, arg, 1);
|
||||||
obj->callbacks.barval = &mem_with_buffers_barval;
|
obj->callbacks.barval = &mem_with_buffers_barval;
|
||||||
#ifdef BUILD_X11
|
#ifdef BUILD_GUI
|
||||||
END OBJ(memgraph, &update_meminfo) char *buf = nullptr;
|
END OBJ(memgraph, &update_meminfo) char *buf = nullptr;
|
||||||
buf = scan_graph(obj, arg, 1);
|
buf = scan_graph(obj, arg, 1);
|
||||||
free_and_zero(buf);
|
free_and_zero(buf);
|
||||||
|
@ -1210,7 +1210,7 @@ struct text_object *construct_text_object(char *s, const char *arg, long line,
|
||||||
buf = scan_graph(obj, arg, 1);
|
buf = scan_graph(obj, arg, 1);
|
||||||
free_and_zero(buf);
|
free_and_zero(buf);
|
||||||
obj->callbacks.graphval = &mem_with_buffers_barval;
|
obj->callbacks.graphval = &mem_with_buffers_barval;
|
||||||
#endif /* BUILD_X11*/
|
#endif /* BUILD_GUI*/
|
||||||
#ifdef HAVE_SOME_SOUNDCARD_H
|
#ifdef HAVE_SOME_SOUNDCARD_H
|
||||||
END OBJ(mixer, 0) parse_mixer_arg(obj, arg);
|
END OBJ(mixer, 0) parse_mixer_arg(obj, arg);
|
||||||
obj->callbacks.percentage = &mixer_percentage;
|
obj->callbacks.percentage = &mixer_percentage;
|
||||||
|
@ -1227,13 +1227,13 @@ struct text_object *construct_text_object(char *s, const char *arg, long line,
|
||||||
END OBJ_IF(if_mixer_mute, 0) parse_mixer_arg(obj, arg);
|
END OBJ_IF(if_mixer_mute, 0) parse_mixer_arg(obj, arg);
|
||||||
obj->callbacks.iftest = &check_mixer_muted;
|
obj->callbacks.iftest = &check_mixer_muted;
|
||||||
#endif /* HAVE_SOME_SOUNDCARD_H */
|
#endif /* HAVE_SOME_SOUNDCARD_H */
|
||||||
#ifdef BUILD_X11
|
#ifdef BUILD_GUI
|
||||||
END OBJ(monitor, nullptr) obj->callbacks.print = &print_monitor;
|
END OBJ(monitor, nullptr) obj->callbacks.print = &print_monitor;
|
||||||
END OBJ(monitor_number, nullptr) obj->callbacks.print = &print_monitor_number;
|
END OBJ(monitor_number, nullptr) obj->callbacks.print = &print_monitor_number;
|
||||||
END OBJ(desktop, nullptr) obj->callbacks.print = &print_desktop;
|
END OBJ(desktop, nullptr) obj->callbacks.print = &print_desktop;
|
||||||
END OBJ(desktop_number, nullptr) obj->callbacks.print = &print_desktop_number;
|
END OBJ(desktop_number, nullptr) obj->callbacks.print = &print_desktop_number;
|
||||||
END OBJ(desktop_name, nullptr) obj->callbacks.print = &print_desktop_name;
|
END OBJ(desktop_name, nullptr) obj->callbacks.print = &print_desktop_name;
|
||||||
#endif /* BUILD_X11 */
|
#endif /* BUILD_GUI */
|
||||||
END OBJ_ARG(format_time, nullptr, "format_time needs a pid as argument")
|
END OBJ_ARG(format_time, nullptr, "format_time needs a pid as argument")
|
||||||
obj->sub = static_cast<text_object *>(malloc(sizeof(struct text_object)));
|
obj->sub = static_cast<text_object *>(malloc(sizeof(struct text_object)));
|
||||||
extract_variable_text_internal(obj->sub, arg);
|
extract_variable_text_internal(obj->sub, arg);
|
||||||
|
@ -1405,22 +1405,22 @@ struct text_object *construct_text_object(char *s, const char *arg, long line,
|
||||||
#endif
|
#endif
|
||||||
#endif /* __linux__ */
|
#endif /* __linux__ */
|
||||||
END OBJ(shadecolor, nullptr)
|
END OBJ(shadecolor, nullptr)
|
||||||
#ifdef BUILD_X11
|
#ifdef BUILD_GUI
|
||||||
obj->data.l =
|
obj->data.l =
|
||||||
arg != nullptr ? get_x11_color(arg) : default_shade_color.get(*state);
|
arg != nullptr ? get_x11_color(arg) : default_shade_color.get(*state);
|
||||||
obj->callbacks.print = &new_bg;
|
obj->callbacks.print = &new_bg;
|
||||||
#endif /* BUILD_X11 */
|
#endif /* BUILD_GUI */
|
||||||
END OBJ(outlinecolor, nullptr)
|
END OBJ(outlinecolor, nullptr)
|
||||||
#ifdef BUILD_X11
|
#ifdef BUILD_GUI
|
||||||
obj->data.l =
|
obj->data.l =
|
||||||
arg != nullptr ? get_x11_color(arg) : default_outline_color.get(*state);
|
arg != nullptr ? get_x11_color(arg) : default_outline_color.get(*state);
|
||||||
obj->callbacks.print = &new_outline;
|
obj->callbacks.print = &new_outline;
|
||||||
#endif /* BUILD_X11 */
|
#endif /* BUILD_GUI */
|
||||||
END OBJ(stippled_hr, nullptr)
|
END OBJ(stippled_hr, nullptr)
|
||||||
#ifdef BUILD_X11
|
#ifdef BUILD_GUI
|
||||||
scan_stippled_hr(obj, arg);
|
scan_stippled_hr(obj, arg);
|
||||||
obj->callbacks.print = &new_stippled_hr;
|
obj->callbacks.print = &new_stippled_hr;
|
||||||
#endif /* BUILD_X11 */
|
#endif /* BUILD_GUI */
|
||||||
END OBJ(swap, &update_meminfo) obj->data.s = STRNDUP_ARG;
|
END OBJ(swap, &update_meminfo) obj->data.s = STRNDUP_ARG;
|
||||||
obj->callbacks.print = &print_swap;
|
obj->callbacks.print = &print_swap;
|
||||||
obj->callbacks.free = &gen_free_opaque;
|
obj->callbacks.free = &gen_free_opaque;
|
||||||
|
@ -1489,7 +1489,7 @@ struct text_object *construct_text_object(char *s, const char *arg, long line,
|
||||||
END OBJ(upspeedf, &update_net_stats)
|
END OBJ(upspeedf, &update_net_stats)
|
||||||
parse_net_stat_arg(obj, arg, free_at_crash);
|
parse_net_stat_arg(obj, arg, free_at_crash);
|
||||||
obj->callbacks.print = &print_upspeedf;
|
obj->callbacks.print = &print_upspeedf;
|
||||||
#ifdef BUILD_X11
|
#ifdef BUILD_GUI
|
||||||
END OBJ(upspeedgraph, &update_net_stats)
|
END OBJ(upspeedgraph, &update_net_stats)
|
||||||
parse_net_stat_graph_arg(obj, arg, free_at_crash);
|
parse_net_stat_graph_arg(obj, arg, free_at_crash);
|
||||||
obj->callbacks.graphval = &upspeedgraphval;
|
obj->callbacks.graphval = &upspeedgraphval;
|
||||||
|
@ -1782,7 +1782,7 @@ struct text_object *construct_text_object(char *s, const char *arg, long line,
|
||||||
}
|
}
|
||||||
obj->callbacks.barval = &lua_barval;
|
obj->callbacks.barval = &lua_barval;
|
||||||
obj->callbacks.free = &gen_free_opaque;
|
obj->callbacks.free = &gen_free_opaque;
|
||||||
#ifdef BUILD_X11
|
#ifdef BUILD_GUI
|
||||||
END OBJ_ARG(
|
END OBJ_ARG(
|
||||||
lua_graph, nullptr,
|
lua_graph, nullptr,
|
||||||
"lua_graph needs arguments: <function name> [height],[width] [gradient "
|
"lua_graph needs arguments: <function name> [height],[width] [gradient "
|
||||||
|
@ -1809,7 +1809,7 @@ struct text_object *construct_text_object(char *s, const char *arg, long line,
|
||||||
}
|
}
|
||||||
obj->callbacks.gaugeval = &lua_barval;
|
obj->callbacks.gaugeval = &lua_barval;
|
||||||
obj->callbacks.free = &gen_free_opaque;
|
obj->callbacks.free = &gen_free_opaque;
|
||||||
#endif /* BUILD_X11 */
|
#endif /* BUILD_GUI */
|
||||||
#ifdef BUILD_HDDTEMP
|
#ifdef BUILD_HDDTEMP
|
||||||
END OBJ(hddtemp, &update_hddtemp) if (arg) obj->data.s = STRNDUP_ARG;
|
END OBJ(hddtemp, &update_hddtemp) if (arg) obj->data.s = STRNDUP_ARG;
|
||||||
obj->callbacks.print = &print_hddtemp;
|
obj->callbacks.print = &print_hddtemp;
|
||||||
|
@ -1843,9 +1843,9 @@ struct text_object *construct_text_object(char *s, const char *arg, long line,
|
||||||
obj->callbacks.free = &free_stock;
|
obj->callbacks.free = &free_stock;
|
||||||
#endif /* BUILD_CURL */
|
#endif /* BUILD_CURL */
|
||||||
END OBJ(scroll, nullptr)
|
END OBJ(scroll, nullptr)
|
||||||
#ifdef BUILD_X11
|
#ifdef BUILD_GUI
|
||||||
/* allocate a follower to reset any color changes */
|
/* allocate a follower to reset any color changes */
|
||||||
#endif /* BUILD_X11 */
|
#endif /* BUILD_GUI */
|
||||||
parse_scroll_arg(obj, arg, free_at_crash, s);
|
parse_scroll_arg(obj, arg, free_at_crash, s);
|
||||||
obj->callbacks.print = &print_scroll;
|
obj->callbacks.print = &print_scroll;
|
||||||
obj->callbacks.free = &free_scroll;
|
obj->callbacks.free = &free_scroll;
|
||||||
|
@ -1923,14 +1923,14 @@ struct text_object *construct_text_object(char *s, const char *arg, long line,
|
||||||
&print_apcupsd_load;
|
&print_apcupsd_load;
|
||||||
END OBJ(apcupsd_loadbar, &update_apcupsd) scan_bar(obj, arg, 100);
|
END OBJ(apcupsd_loadbar, &update_apcupsd) scan_bar(obj, arg, 100);
|
||||||
obj->callbacks.barval = &apcupsd_loadbarval;
|
obj->callbacks.barval = &apcupsd_loadbarval;
|
||||||
#ifdef BUILD_X11
|
#ifdef BUILD_GUI
|
||||||
END OBJ(apcupsd_loadgraph, &update_apcupsd) char *buf = nullptr;
|
END OBJ(apcupsd_loadgraph, &update_apcupsd) char *buf = nullptr;
|
||||||
buf = scan_graph(obj, arg, 100);
|
buf = scan_graph(obj, arg, 100);
|
||||||
free_and_zero(buf);
|
free_and_zero(buf);
|
||||||
obj->callbacks.graphval = &apcupsd_loadbarval;
|
obj->callbacks.graphval = &apcupsd_loadbarval;
|
||||||
END OBJ(apcupsd_loadgauge, &update_apcupsd) scan_gauge(obj, arg, 100);
|
END OBJ(apcupsd_loadgauge, &update_apcupsd) scan_gauge(obj, arg, 100);
|
||||||
obj->callbacks.gaugeval = &apcupsd_loadbarval;
|
obj->callbacks.gaugeval = &apcupsd_loadbarval;
|
||||||
#endif /* BUILD_X11 */
|
#endif /* BUILD_GUI */
|
||||||
END OBJ(apcupsd_charge, &update_apcupsd) obj->callbacks.print =
|
END OBJ(apcupsd_charge, &update_apcupsd) obj->callbacks.print =
|
||||||
&print_apcupsd_charge;
|
&print_apcupsd_charge;
|
||||||
END OBJ(apcupsd_timeleft, &update_apcupsd) obj->callbacks.print =
|
END OBJ(apcupsd_timeleft, &update_apcupsd) obj->callbacks.print =
|
||||||
|
|
|
@ -170,7 +170,7 @@ void print_diskio_write(struct text_object *obj, char *p,
|
||||||
print_diskio_dir(obj, 1, p, p_max_size);
|
print_diskio_dir(obj, 1, p, p_max_size);
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifdef BUILD_X11
|
#ifdef BUILD_GUI
|
||||||
void parse_diskiograph_arg(struct text_object *obj, const char *arg) {
|
void parse_diskiograph_arg(struct text_object *obj, const char *arg) {
|
||||||
char *buf = nullptr;
|
char *buf = nullptr;
|
||||||
buf = scan_graph(obj, arg, 0);
|
buf = scan_graph(obj, arg, 0);
|
||||||
|
@ -196,7 +196,7 @@ double diskiographval_write(struct text_object *obj) {
|
||||||
|
|
||||||
return (diskio != nullptr ? diskio->current_write : 0);
|
return (diskio != nullptr ? diskio->current_write : 0);
|
||||||
}
|
}
|
||||||
#endif /* BUILD_X11 */
|
#endif /* BUILD_GUI */
|
||||||
|
|
||||||
void update_diskio_values(struct diskio_stat *ds, unsigned int reads,
|
void update_diskio_values(struct diskio_stat *ds, unsigned int reads,
|
||||||
unsigned int writes) {
|
unsigned int writes) {
|
||||||
|
|
|
@ -70,11 +70,11 @@ void parse_diskio_arg(struct text_object *, const char *);
|
||||||
void print_diskio(struct text_object *, char *, unsigned int);
|
void print_diskio(struct text_object *, char *, unsigned int);
|
||||||
void print_diskio_read(struct text_object *, char *, unsigned int);
|
void print_diskio_read(struct text_object *, char *, unsigned int);
|
||||||
void print_diskio_write(struct text_object *, char *, unsigned int);
|
void print_diskio_write(struct text_object *, char *, unsigned int);
|
||||||
#ifdef BUILD_X11
|
#ifdef BUILD_GUI
|
||||||
void parse_diskiograph_arg(struct text_object *, const char *);
|
void parse_diskiograph_arg(struct text_object *, const char *);
|
||||||
double diskiographval(struct text_object *);
|
double diskiographval(struct text_object *);
|
||||||
double diskiographval_read(struct text_object *);
|
double diskiographval_read(struct text_object *);
|
||||||
double diskiographval_write(struct text_object *);
|
double diskiographval_write(struct text_object *);
|
||||||
#endif /* BUILD_X11 */
|
#endif /* BUILD_GUI */
|
||||||
|
|
||||||
#endif /* DISKIO_H_ */
|
#endif /* DISKIO_H_ */
|
||||||
|
|
|
@ -270,7 +270,7 @@ void scan_exec_arg(struct text_object *obj, const char *arg,
|
||||||
/* parse any special options for the graphical exec types */
|
/* parse any special options for the graphical exec types */
|
||||||
if ((execflag & EF_BAR) != 0u) {
|
if ((execflag & EF_BAR) != 0u) {
|
||||||
cmd = scan_bar(obj, cmd, 100);
|
cmd = scan_bar(obj, cmd, 100);
|
||||||
#ifdef BUILD_X11
|
#ifdef BUILD_GUI
|
||||||
} else if ((execflag & EF_GAUGE) != 0u) {
|
} else if ((execflag & EF_GAUGE) != 0u) {
|
||||||
cmd = scan_gauge(obj, cmd, 100);
|
cmd = scan_gauge(obj, cmd, 100);
|
||||||
} else if ((execflag & EF_GRAPH) != 0u) {
|
} else if ((execflag & EF_GRAPH) != 0u) {
|
||||||
|
@ -278,7 +278,7 @@ void scan_exec_arg(struct text_object *obj, const char *arg,
|
||||||
if (cmd == nullptr) {
|
if (cmd == nullptr) {
|
||||||
NORM_ERR("error parsing arguments to execgraph object");
|
NORM_ERR("error parsing arguments to execgraph object");
|
||||||
}
|
}
|
||||||
#endif /* BUILD_X11 */
|
#endif /* BUILD_GUI */
|
||||||
}
|
}
|
||||||
|
|
||||||
/* finally, store the resulting command, or an empty string if something went
|
/* finally, store the resulting command, or an empty string if something went
|
||||||
|
|
|
@ -92,7 +92,7 @@ conky::simple_config_setting<std::string> lua_startup_hook("lua_startup_hook",
|
||||||
conky::simple_config_setting<std::string> lua_shutdown_hook("lua_shutdown_hook",
|
conky::simple_config_setting<std::string> lua_shutdown_hook("lua_shutdown_hook",
|
||||||
std::string(),
|
std::string(),
|
||||||
true);
|
true);
|
||||||
#ifdef BUILD_X11
|
#ifdef BUILD_GUI
|
||||||
conky::simple_config_setting<std::string> lua_draw_hook_pre("lua_draw_hook_pre",
|
conky::simple_config_setting<std::string> lua_draw_hook_pre("lua_draw_hook_pre",
|
||||||
std::string(),
|
std::string(),
|
||||||
true);
|
true);
|
||||||
|
@ -464,7 +464,7 @@ void llua_shutdown_hook() {
|
||||||
llua_do_call(lua_shutdown_hook.get(*state).c_str(), 0);
|
llua_do_call(lua_shutdown_hook.get(*state).c_str(), 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifdef BUILD_X11
|
#ifdef BUILD_GUI
|
||||||
void llua_draw_pre_hook() {
|
void llua_draw_pre_hook() {
|
||||||
if ((lua_L == nullptr) || lua_draw_hook_pre.get(*state).empty()) { return; }
|
if ((lua_L == nullptr) || lua_draw_hook_pre.get(*state).empty()) { return; }
|
||||||
llua_do_call(lua_draw_hook_pre.get(*state).c_str(), 0);
|
llua_do_call(lua_draw_hook_pre.get(*state).c_str(), 0);
|
||||||
|
@ -526,7 +526,7 @@ void llua_update_window_table(int text_start_x, int text_start_y,
|
||||||
|
|
||||||
lua_setglobal(lua_L, "conky_window");
|
lua_setglobal(lua_L, "conky_window");
|
||||||
}
|
}
|
||||||
#endif /* BUILD_X11 */
|
#endif /* BUILD_GUI */
|
||||||
|
|
||||||
void llua_setup_info(struct information *i, double u_interval) {
|
void llua_setup_info(struct information *i, double u_interval) {
|
||||||
if (lua_L == nullptr) { return; }
|
if (lua_L == nullptr) { return; }
|
||||||
|
|
|
@ -46,7 +46,7 @@ void llua_inotify_query(int wd, int mask);
|
||||||
void llua_startup_hook(void);
|
void llua_startup_hook(void);
|
||||||
void llua_shutdown_hook(void);
|
void llua_shutdown_hook(void);
|
||||||
|
|
||||||
#ifdef BUILD_X11
|
#ifdef BUILD_GUI
|
||||||
void llua_draw_pre_hook(void);
|
void llua_draw_pre_hook(void);
|
||||||
void llua_draw_post_hook(void);
|
void llua_draw_post_hook(void);
|
||||||
|
|
||||||
|
@ -54,7 +54,7 @@ void llua_setup_window_table(int text_start_x, int text_start_y, int text_width,
|
||||||
int text_height);
|
int text_height);
|
||||||
void llua_update_window_table(int text_start_x, int text_start_y,
|
void llua_update_window_table(int text_start_x, int text_start_y,
|
||||||
int text_width, int text_height);
|
int text_width, int text_height);
|
||||||
#endif /* BUILD_X11 */
|
#endif /* BUILD_GUI */
|
||||||
|
|
||||||
void llua_setup_info(struct information *i, double u_interval);
|
void llua_setup_info(struct information *i, double u_interval);
|
||||||
void llua_update_info(struct information *i, double u_interval);
|
void llua_update_info(struct information *i, double u_interval);
|
||||||
|
|
|
@ -319,7 +319,7 @@ void print_v6addrs(struct text_object *obj, char *p, unsigned int p_max_size) {
|
||||||
|
|
||||||
#endif /* __linux__ */
|
#endif /* __linux__ */
|
||||||
|
|
||||||
#ifdef BUILD_X11
|
#ifdef BUILD_GUI
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* This function is called periodically to update the download and upload graphs
|
* This function is called periodically to update the download and upload graphs
|
||||||
|
@ -370,7 +370,7 @@ double upspeedgraphval(struct text_object *obj) {
|
||||||
|
|
||||||
return (ns != nullptr ? ns->trans_speed : 0);
|
return (ns != nullptr ? ns->trans_speed : 0);
|
||||||
}
|
}
|
||||||
#endif /* BUILD_X11 */
|
#endif /* BUILD_GUI */
|
||||||
|
|
||||||
#ifdef BUILD_WLAN
|
#ifdef BUILD_WLAN
|
||||||
void print_wireless_essid(struct text_object *obj, char *p,
|
void print_wireless_essid(struct text_object *obj, char *p,
|
||||||
|
|
|
@ -102,11 +102,11 @@ void print_addrs(struct text_object *, char *, unsigned int);
|
||||||
void print_v6addrs(struct text_object *, char *, unsigned int);
|
void print_v6addrs(struct text_object *, char *, unsigned int);
|
||||||
#endif /* BUILD_IPV6 */
|
#endif /* BUILD_IPV6 */
|
||||||
#endif /* __linux__ */
|
#endif /* __linux__ */
|
||||||
#ifdef BUILD_X11
|
#ifdef BUILD_GUI
|
||||||
void parse_net_stat_graph_arg(struct text_object *, const char *, void *);
|
void parse_net_stat_graph_arg(struct text_object *, const char *, void *);
|
||||||
double downspeedgraphval(struct text_object *);
|
double downspeedgraphval(struct text_object *);
|
||||||
double upspeedgraphval(struct text_object *);
|
double upspeedgraphval(struct text_object *);
|
||||||
#endif /* BUILD_X11 */
|
#endif /* BUILD_GUI */
|
||||||
#ifdef BUILD_WLAN
|
#ifdef BUILD_WLAN
|
||||||
void print_wireless_essid(struct text_object *, char *, unsigned int);
|
void print_wireless_essid(struct text_object *, char *, unsigned int);
|
||||||
void print_wireless_channel(struct text_object *, char *, unsigned int);
|
void print_wireless_channel(struct text_object *, char *, unsigned int);
|
||||||
|
|
|
@ -39,7 +39,7 @@
|
||||||
* @param c first byte of the character
|
* @param c first byte of the character
|
||||||
*/
|
*/
|
||||||
inline int scroll_character_length(char c) {
|
inline int scroll_character_length(char c) {
|
||||||
#ifdef BUILD_X11
|
#ifdef BUILD_GUI
|
||||||
if (utf8_mode.get(*state)) {
|
if (utf8_mode.get(*state)) {
|
||||||
auto uc = static_cast<unsigned char>(c);
|
auto uc = static_cast<unsigned char>(c);
|
||||||
int len = 0;
|
int len = 0;
|
||||||
|
@ -64,7 +64,7 @@ inline int scroll_character_length(char c) {
|
||||||
* right.
|
* right.
|
||||||
*/
|
*/
|
||||||
inline bool scroll_check_skip_byte(char c) {
|
inline bool scroll_check_skip_byte(char c) {
|
||||||
#ifdef BUILD_X11
|
#ifdef BUILD_GUI
|
||||||
// Check if byte matches UTF-8 continuation byte pattern (0b10xxxxxx)
|
// Check if byte matches UTF-8 continuation byte pattern (0b10xxxxxx)
|
||||||
if (utf8_mode.get(*state) && (c & 0xC0) == 0x80) { return true; }
|
if (utf8_mode.get(*state) && (c & 0xC0) == 0x80) { return true; }
|
||||||
#endif
|
#endif
|
||||||
|
@ -157,7 +157,7 @@ void parse_scroll_arg(struct text_object *obj, const char *arg,
|
||||||
|
|
||||||
if ((arg == nullptr) || sscanf(arg + n1, "%u %n", &sd->show, &n2) <= 0) {
|
if ((arg == nullptr) || sscanf(arg + n1, "%u %n", &sd->show, &n2) <= 0) {
|
||||||
free(sd);
|
free(sd);
|
||||||
#ifdef BUILD_X11
|
#ifdef BUILD_GUI
|
||||||
free(obj->next);
|
free(obj->next);
|
||||||
#endif
|
#endif
|
||||||
free(free_at_crash2);
|
free(free_at_crash2);
|
||||||
|
@ -199,9 +199,9 @@ void parse_scroll_arg(struct text_object *obj, const char *arg,
|
||||||
|
|
||||||
obj->data.opaque = sd;
|
obj->data.opaque = sd;
|
||||||
|
|
||||||
#ifdef BUILD_X11
|
#ifdef BUILD_GUI
|
||||||
/* add a color object right after scroll to reset any color changes */
|
/* add a color object right after scroll to reset any color changes */
|
||||||
#endif /* BUILD_X11 */
|
#endif /* BUILD_GUI */
|
||||||
}
|
}
|
||||||
|
|
||||||
void print_scroll(struct text_object *obj, char *p, unsigned int p_max_size) {
|
void print_scroll(struct text_object *obj, char *p, unsigned int p_max_size) {
|
||||||
|
@ -321,7 +321,7 @@ void print_scroll(struct text_object *obj, char *p, unsigned int p_max_size) {
|
||||||
scroll_scroll_right(sd, buf, sd->step);
|
scroll_scroll_right(sd, buf, sd->step);
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifdef BUILD_X11
|
#ifdef BUILD_GUI
|
||||||
// reset color when scroll is finished
|
// reset color when scroll is finished
|
||||||
if (out_to_x.get(*state)) {
|
if (out_to_x.get(*state)) {
|
||||||
new_special(p + strlen(p), FG)->arg = sd->resetcolor;
|
new_special(p + strlen(p), FG)->arg = sd->resetcolor;
|
||||||
|
|
|
@ -27,9 +27,9 @@
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
#include "conky.h"
|
#include "conky.h"
|
||||||
#ifdef BUILD_X11
|
#ifdef BUILD_GUI
|
||||||
#include "fonts.h"
|
#include "fonts.h"
|
||||||
#endif /* BUILD_X11 */
|
#endif /* BUILD_GUI */
|
||||||
#include <cmath>
|
#include <cmath>
|
||||||
#include "logging.h"
|
#include "logging.h"
|
||||||
#include "nc.h"
|
#include "nc.h"
|
||||||
|
@ -57,7 +57,7 @@ conky::range_config_setting<int> default_bar_width(
|
||||||
conky::range_config_setting<int> default_bar_height(
|
conky::range_config_setting<int> default_bar_height(
|
||||||
"default_bar_height", 0, std::numeric_limits<int>::max(), 6, false);
|
"default_bar_height", 0, std::numeric_limits<int>::max(), 6, false);
|
||||||
|
|
||||||
#ifdef BUILD_X11
|
#ifdef BUILD_GUI
|
||||||
conky::range_config_setting<int> default_graph_width(
|
conky::range_config_setting<int> default_graph_width(
|
||||||
"default_graph_width", 0, std::numeric_limits<int>::max(), 0, false);
|
"default_graph_width", 0, std::numeric_limits<int>::max(), 0, false);
|
||||||
conky::range_config_setting<int> default_graph_height(
|
conky::range_config_setting<int> default_graph_height(
|
||||||
|
@ -67,7 +67,7 @@ conky::range_config_setting<int> default_gauge_width(
|
||||||
"default_gauge_width", 0, std::numeric_limits<int>::max(), 40, false);
|
"default_gauge_width", 0, std::numeric_limits<int>::max(), 40, false);
|
||||||
conky::range_config_setting<int> default_gauge_height(
|
conky::range_config_setting<int> default_gauge_height(
|
||||||
"default_gauge_height", 0, std::numeric_limits<int>::max(), 25, false);
|
"default_gauge_height", 0, std::numeric_limits<int>::max(), 25, false);
|
||||||
#endif /* BUILD_X11 */
|
#endif /* BUILD_GUI */
|
||||||
|
|
||||||
conky::simple_config_setting<std::string> console_graph_ticks(
|
conky::simple_config_setting<std::string> console_graph_ticks(
|
||||||
"console_graph_ticks", " ,_,=,#", false);
|
"console_graph_ticks", " ,_,=,#", false);
|
||||||
|
@ -114,7 +114,7 @@ struct tab {
|
||||||
* Scanning arguments to various special text objects
|
* Scanning arguments to various special text objects
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#ifdef BUILD_X11
|
#ifdef BUILD_GUI
|
||||||
const char *scan_gauge(struct text_object *obj, const char *args,
|
const char *scan_gauge(struct text_object *obj, const char *args,
|
||||||
double scale) {
|
double scale) {
|
||||||
struct gauge *g;
|
struct gauge *g;
|
||||||
|
@ -179,7 +179,7 @@ const char *scan_bar(struct text_object *obj, const char *args, double scale) {
|
||||||
return args;
|
return args;
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifdef BUILD_X11
|
#ifdef BUILD_GUI
|
||||||
void scan_font(struct text_object *obj, const char *args) {
|
void scan_font(struct text_object *obj, const char *args) {
|
||||||
if ((args != nullptr) && (*args != 0)) {
|
if ((args != nullptr) && (*args != 0)) {
|
||||||
obj->data.s = strndup(args, DEFAULT_TEXT_BUFFER_SIZE);
|
obj->data.s = strndup(args, DEFAULT_TEXT_BUFFER_SIZE);
|
||||||
|
@ -337,7 +337,7 @@ char *scan_graph(struct text_object *obj, const char *args, double defscale) {
|
||||||
|
|
||||||
return nullptr;
|
return nullptr;
|
||||||
}
|
}
|
||||||
#endif /* BUILD_X11 */
|
#endif /* BUILD_GUI */
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Printing various special text objects
|
* Printing various special text objects
|
||||||
|
@ -384,7 +384,7 @@ void new_gauge_in_shell(struct text_object *obj, char *p,
|
||||||
gaugevals[round_to_positive_int(usage * 4 / g->scale)]);
|
gaugevals[round_to_positive_int(usage * 4 / g->scale)]);
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifdef BUILD_X11
|
#ifdef BUILD_GUI
|
||||||
void new_gauge_in_x11(struct text_object *obj, char *buf, double usage) {
|
void new_gauge_in_x11(struct text_object *obj, char *buf, double usage) {
|
||||||
struct special_t *s = nullptr;
|
struct special_t *s = nullptr;
|
||||||
auto *g = static_cast<struct gauge *>(obj->special_data);
|
auto *g = static_cast<struct gauge *>(obj->special_data);
|
||||||
|
@ -400,7 +400,7 @@ void new_gauge_in_x11(struct text_object *obj, char *buf, double usage) {
|
||||||
s->height = xft_dpi_scale(g->height);
|
s->height = xft_dpi_scale(g->height);
|
||||||
s->scale = g->scale;
|
s->scale = g->scale;
|
||||||
}
|
}
|
||||||
#endif /* BUILD_X11 */
|
#endif /* BUILD_GUI */
|
||||||
|
|
||||||
void new_gauge(struct text_object *obj, char *p, unsigned int p_max_size,
|
void new_gauge(struct text_object *obj, char *p, unsigned int p_max_size,
|
||||||
double usage) {
|
double usage) {
|
||||||
|
@ -414,17 +414,17 @@ void new_gauge(struct text_object *obj, char *p, unsigned int p_max_size,
|
||||||
usage = std::min(g->scale, usage);
|
usage = std::min(g->scale, usage);
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifdef BUILD_X11
|
#ifdef BUILD_GUI
|
||||||
if (out_to_x.get(*state)) { new_gauge_in_x11(obj, p, usage); }
|
if (out_to_x.get(*state)) { new_gauge_in_x11(obj, p, usage); }
|
||||||
if (out_to_stdout.get(*state)) {
|
if (out_to_stdout.get(*state)) {
|
||||||
new_gauge_in_shell(obj, p, p_max_size, usage);
|
new_gauge_in_shell(obj, p, p_max_size, usage);
|
||||||
}
|
}
|
||||||
#else /* BUILD_X11 */
|
#else /* BUILD_GUI */
|
||||||
new_gauge_in_shell(obj, p, p_max_size, usage);
|
new_gauge_in_shell(obj, p, p_max_size, usage);
|
||||||
#endif /* BUILD_X11 */
|
#endif /* BUILD_GUI */
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifdef BUILD_X11
|
#ifdef BUILD_GUI
|
||||||
void new_font(struct text_object *obj, char *p, unsigned int p_max_size) {
|
void new_font(struct text_object *obj, char *p, unsigned int p_max_size) {
|
||||||
struct special_t *s;
|
struct special_t *s;
|
||||||
unsigned int tmp = selected_font;
|
unsigned int tmp = selected_font;
|
||||||
|
@ -645,12 +645,12 @@ void new_stippled_hr(struct text_object *obj, char *p,
|
||||||
s->height = xft_dpi_scale(sh->height);
|
s->height = xft_dpi_scale(sh->height);
|
||||||
s->arg = xft_dpi_scale(sh->arg);
|
s->arg = xft_dpi_scale(sh->arg);
|
||||||
}
|
}
|
||||||
#endif /* BUILD_X11 */
|
#endif /* BUILD_GUI */
|
||||||
|
|
||||||
void new_fg(struct text_object *obj, char *p, unsigned int p_max_size) {
|
void new_fg(struct text_object *obj, char *p, unsigned int p_max_size) {
|
||||||
#ifdef BUILD_X11
|
#ifdef BUILD_GUI
|
||||||
if (out_to_x.get(*state)) { new_special(p, FG)->arg = obj->data.l; }
|
if (out_to_x.get(*state)) { new_special(p, FG)->arg = obj->data.l; }
|
||||||
#endif /* BUILD_X11 */
|
#endif /* BUILD_GUI */
|
||||||
#ifdef BUILD_NCURSES
|
#ifdef BUILD_NCURSES
|
||||||
if (out_to_ncurses.get(*state)) { new_special(p, FG)->arg = obj->data.l; }
|
if (out_to_ncurses.get(*state)) { new_special(p, FG)->arg = obj->data.l; }
|
||||||
#endif /* BUILD_NCURSES */
|
#endif /* BUILD_NCURSES */
|
||||||
|
@ -659,7 +659,7 @@ void new_fg(struct text_object *obj, char *p, unsigned int p_max_size) {
|
||||||
UNUSED(p_max_size);
|
UNUSED(p_max_size);
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifdef BUILD_X11
|
#ifdef BUILD_GUI
|
||||||
void new_bg(struct text_object *obj, char *p, unsigned int p_max_size) {
|
void new_bg(struct text_object *obj, char *p, unsigned int p_max_size) {
|
||||||
if (!out_to_x.get(*state)) { return; }
|
if (!out_to_x.get(*state)) { return; }
|
||||||
|
|
||||||
|
@ -667,7 +667,7 @@ void new_bg(struct text_object *obj, char *p, unsigned int p_max_size) {
|
||||||
|
|
||||||
new_special(p, BG)->arg = obj->data.l;
|
new_special(p, BG)->arg = obj->data.l;
|
||||||
}
|
}
|
||||||
#endif /* BUILD_X11 */
|
#endif /* BUILD_GUI */
|
||||||
|
|
||||||
static void new_bar_in_shell(struct text_object *obj, char *buffer,
|
static void new_bar_in_shell(struct text_object *obj, char *buffer,
|
||||||
unsigned int buf_max_size, double usage) {
|
unsigned int buf_max_size, double usage) {
|
||||||
|
@ -692,7 +692,7 @@ static void new_bar_in_shell(struct text_object *obj, char *buffer,
|
||||||
buffer[i] = 0;
|
buffer[i] = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifdef BUILD_X11
|
#ifdef BUILD_GUI
|
||||||
static void new_bar_in_x11(struct text_object *obj, char *buf, double usage) {
|
static void new_bar_in_x11(struct text_object *obj, char *buf, double usage) {
|
||||||
struct special_t *s = nullptr;
|
struct special_t *s = nullptr;
|
||||||
auto *b = static_cast<struct bar *>(obj->special_data);
|
auto *b = static_cast<struct bar *>(obj->special_data);
|
||||||
|
@ -708,7 +708,7 @@ static void new_bar_in_x11(struct text_object *obj, char *buf, double usage) {
|
||||||
s->height = xft_dpi_scale(b->height);
|
s->height = xft_dpi_scale(b->height);
|
||||||
s->scale = b->scale;
|
s->scale = b->scale;
|
||||||
}
|
}
|
||||||
#endif /* BUILD_X11 */
|
#endif /* BUILD_GUI */
|
||||||
|
|
||||||
/* usage is in range [0,255] */
|
/* usage is in range [0,255] */
|
||||||
void new_bar(struct text_object *obj, char *p, unsigned int p_max_size,
|
void new_bar(struct text_object *obj, char *p, unsigned int p_max_size,
|
||||||
|
@ -723,14 +723,14 @@ void new_bar(struct text_object *obj, char *p, unsigned int p_max_size,
|
||||||
usage = std::min(b->scale, usage);
|
usage = std::min(b->scale, usage);
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifdef BUILD_X11
|
#ifdef BUILD_GUI
|
||||||
if (out_to_x.get(*state)) { new_bar_in_x11(obj, p, usage); }
|
if (out_to_x.get(*state)) { new_bar_in_x11(obj, p, usage); }
|
||||||
if (out_to_stdout.get(*state)) {
|
if (out_to_stdout.get(*state)) {
|
||||||
new_bar_in_shell(obj, p, p_max_size, usage);
|
new_bar_in_shell(obj, p, p_max_size, usage);
|
||||||
}
|
}
|
||||||
#else /* BUILD_X11 */
|
#else /* BUILD_GUI */
|
||||||
new_bar_in_shell(obj, p, p_max_size, usage);
|
new_bar_in_shell(obj, p, p_max_size, usage);
|
||||||
#endif /* BUILD_X11 */
|
#endif /* BUILD_GUI */
|
||||||
}
|
}
|
||||||
|
|
||||||
void new_outline(struct text_object *obj, char *p, unsigned int p_max_size) {
|
void new_outline(struct text_object *obj, char *p, unsigned int p_max_size) {
|
||||||
|
|
|
@ -87,7 +87,7 @@ struct text_object;
|
||||||
/* scanning special arguments */
|
/* scanning special arguments */
|
||||||
const char *scan_bar(struct text_object *, const char *, double);
|
const char *scan_bar(struct text_object *, const char *, double);
|
||||||
const char *scan_gauge(struct text_object *, const char *, double);
|
const char *scan_gauge(struct text_object *, const char *, double);
|
||||||
#ifdef BUILD_X11
|
#ifdef BUILD_GUI
|
||||||
void scan_font(struct text_object *, const char *);
|
void scan_font(struct text_object *, const char *);
|
||||||
char *scan_graph(struct text_object *, const char *, double);
|
char *scan_graph(struct text_object *, const char *, double);
|
||||||
void scan_tab(struct text_object *, const char *);
|
void scan_tab(struct text_object *, const char *);
|
||||||
|
@ -98,7 +98,7 @@ void new_font(struct text_object *, char *, unsigned int);
|
||||||
void new_graph(struct text_object *, char *, int, double);
|
void new_graph(struct text_object *, char *, int, double);
|
||||||
void new_hr(struct text_object *, char *, unsigned int);
|
void new_hr(struct text_object *, char *, unsigned int);
|
||||||
void new_stippled_hr(struct text_object *, char *, unsigned int);
|
void new_stippled_hr(struct text_object *, char *, unsigned int);
|
||||||
#endif /* BUILD_X11 */
|
#endif /* BUILD_GUI */
|
||||||
void new_gauge(struct text_object *, char *, unsigned int, double);
|
void new_gauge(struct text_object *, char *, unsigned int, double);
|
||||||
void new_bar(struct text_object *, char *, unsigned int, double);
|
void new_bar(struct text_object *, char *, unsigned int, double);
|
||||||
void new_fg(struct text_object *, char *, unsigned int);
|
void new_fg(struct text_object *, char *, unsigned int);
|
||||||
|
|
Loading…
Reference in New Issue
Block a user