diff --git a/src/conky.c b/src/conky.c index 7b0921a1..7e5f5d50 100644 --- a/src/conky.c +++ b/src/conky.c @@ -719,9 +719,9 @@ static void free_text_objects(struct text_object *root) 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: @@ -1472,13 +1472,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); @@ -3789,17 +3789,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; @@ -7108,7 +7122,6 @@ static void load_config_file(const char *f) CONF_ERR; } } -#ifdef X11 CONF("default_bar_size") { char err = 0; if (value) { @@ -7122,6 +7135,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 f951fed4..3d57f3cb 100644 --- a/src/specials.c +++ b/src/specials.c @@ -46,11 +46,15 @@ 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 = 50, default_gauge_height = 25; +#else +int default_bar_width = 10, default_bar_height = 1; +#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 fe915a28..a0ba6985 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,