From 914af765e43e6e1b6f8c0d3bde2f4d832e0b8f59 Mon Sep 17 00:00:00 2001 From: Nikolas Garofil Date: Sun, 17 May 2009 13:38:51 +0200 Subject: [PATCH] execbar can now be used in the shell even when compiled with x11 support --- src/conky.c | 27 +++++++++++++++------------ src/conky.h | 1 + src/specials.c | 4 +--- 3 files changed, 17 insertions(+), 15 deletions(-) diff --git a/src/conky.c b/src/conky.c index ac758241..01255234 100644 --- a/src/conky.c +++ b/src/conky.c @@ -3799,26 +3799,29 @@ static void generate_text_internal(char *p, int p_max_size, #endif OBJ(execbar) { double barnum; -#ifndef X11 int i; -#endif 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, obj->b, round_to_int(barnum * 255.0)); + }else{ +#endif + if(!obj->a) obj->a = DEFAULT_BAR_WIDTH_NO_X; + barnum = round_to_int( ( barnum * obj->a ) / 100); + for(i=0; ia; i++) { + *(p+i)='_'; + } + *(p+i)=0; +#ifdef X11 } - for(; i < obj->a; i++) { - *(p+i)='_'; - } - *(p+i)=0; #endif } } diff --git a/src/conky.h b/src/conky.h index b12952ec..bbbdc14a 100644 --- a/src/conky.h +++ b/src/conky.h @@ -43,6 +43,7 @@ #define FALSE 0 #define TRUE 1 +#define DEFAULT_BAR_WIDTH_NO_X 10 #if !defined(__GNUC__) # define __attribute__(x) /* nothing */ diff --git a/src/specials.c b/src/specials.c index 3d57f3cb..0c6f84cc 100644 --- a/src/specials.c +++ b/src/specials.c @@ -42,12 +42,10 @@ struct special_t *specials = NULL; unsigned int special_count; -#ifdef X11 int default_bar_width = 0, default_bar_height = 6; +#ifdef X11 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 /*