diff --git a/src/conky.c b/src/conky.c index cd234c76..5a208437 100644 --- a/src/conky.c +++ b/src/conky.c @@ -725,9 +725,9 @@ static void free_text_objects(struct text_object *root, int internal) case OBJ_image: case OBJ_eval: case OBJ_exec: + case OBJ_execbar: #ifdef X11 case OBJ_execgauge: - case OBJ_execbar: case OBJ_execgraph: #endif case OBJ_execp: @@ -1559,13 +1559,13 @@ static struct text_object *construct_text_object(const char *s, obj->a = default_##arg##_width; \ obj->b = default_##arg##_height; \ } + END OBJ(execbar, 0) + SIZE_DEFAULTS(bar); + obj->data.s = strndup(arg ? arg : "", text_buffer_size); #ifdef X11 END OBJ(execgauge, 0) SIZE_DEFAULTS(gauge); obj->data.s = strndup(arg ? arg : "", text_buffer_size); - END OBJ(execbar, 0) - SIZE_DEFAULTS(bar); - obj->data.s = strndup(arg ? arg : "", text_buffer_size); END OBJ(execgraph, 0) SIZE_DEFAULTS(graph); obj->data.s = strndup(arg ? arg : "", text_buffer_size); @@ -3881,17 +3881,31 @@ static void generate_text_internal(char *p, int p_max_size, new_gauge(p, obj->a, obj->b, round_to_int(barnum * 255.0)); } } +#endif OBJ(execbar) { double barnum; + int i; read_exec(obj->data.s, p, text_buffer_size); barnum = get_barnum(p); if (barnum >= 0.0) { +#ifdef X11 barnum /= 100; new_bar(p, obj->a, obj->b, round_to_int(barnum * 255.0)); +#else + barnum = round_to_int( ( barnum * obj->a ) / 100); + for(i=0; ia; i++) { + *(p+i)='_'; + } + *(p+i)=0; +#endif } } +#ifdef X11 OBJ(execgraph) { char showaslog = FALSE; double barnum; @@ -7280,7 +7294,6 @@ static void load_config_file(const char *f) CONF_ERR; } } -#ifdef X11 CONF("default_bar_size") { char err = 0; if (value) { @@ -7294,6 +7307,7 @@ static void load_config_file(const char *f) CONF_ERR2("default_bar_size takes 2 integer arguments (ie. 'default_bar_size 0 6')") } } +#ifdef X11 CONF("default_graph_size") { char err = 0; if (value) { diff --git a/src/specials.c b/src/specials.c index dc789680..a299cf76 100644 --- a/src/specials.c +++ b/src/specials.c @@ -46,11 +46,13 @@ unsigned int special_count; int default_bar_width = 0, default_bar_height = 6; int default_graph_width = 0, default_graph_height = 25; int default_gauge_width = 40, default_gauge_height = 25; +#endif /* * Scanning arguments to various special text objects */ +#ifdef X11 const char *scan_gauge(const char *args, int *w, int *h) { /*width and height*/ diff --git a/src/specials.h b/src/specials.h index c1f9a4e4..2f8d0bf8 100644 --- a/src/specials.h +++ b/src/specials.h @@ -76,9 +76,9 @@ struct special_t { extern struct special_t *specials; extern unsigned int special_count; -#ifdef X11 extern int default_bar_width; extern int default_bar_height; +#ifdef X11 extern int default_graph_width; extern int default_graph_height; extern int default_gauge_width; diff --git a/src/text_object.h b/src/text_object.h index f6c07b06..07467e9c 100644 --- a/src/text_object.h +++ b/src/text_object.h @@ -104,9 +104,9 @@ enum text_object_type { OBJ_exec, OBJ_execi, OBJ_texeci, + OBJ_execbar, #ifdef X11 OBJ_execgauge, - OBJ_execbar, OBJ_execgraph, OBJ_execibar, OBJ_execigraph,