From 7807d369adbcc9f01b0cf06e0b55756f2d7a0b5d Mon Sep 17 00:00:00 2001 From: Nikolas Garofil Date: Tue, 2 Jun 2009 19:16:21 +0200 Subject: [PATCH] Let battery_bar work in shell --- src/conky.c | 15 ++++++++++----- src/text_object.h | 2 -- 2 files changed, 10 insertions(+), 7 deletions(-) diff --git a/src/conky.c b/src/conky.c index c30bd7bf..77a5fde2 100644 --- a/src/conky.c +++ b/src/conky.c @@ -1338,7 +1338,6 @@ static struct text_object *construct_text_object(const char *s, strcpy(bat, "BAT0"); } obj->data.s = strndup(bat, text_buffer_size); -#ifdef X11 END OBJ(battery_bar, 0) char bat[64]; SIZE_DEFAULTS(bar); @@ -1350,7 +1349,6 @@ static struct text_object *construct_text_object(const char *s, strcpy(bat, "BAT0"); } obj->data.s = strndup(bat, text_buffer_size); -#endif #endif /* !__OpenBSD__ */ #if defined(__linux__) @@ -3574,11 +3572,18 @@ static void generate_text_internal(char *p, int p_max_size, OBJ(battery_percent) { percent_print(p, p_max_size, get_battery_perct(obj->data.s)); } -#ifdef X11 OBJ(battery_bar) { - new_bar(p, obj->a, obj->b, get_battery_perct_bar(obj->data.s)); - } +#ifdef X11 + if(output_methods & TO_X) { + new_bar(p, obj->a, obj->b, get_battery_perct_bar(obj->data.s)); + }else{ #endif /* X11 */ + if(!obj->a) obj->a = DEFAULT_BAR_WIDTH_NO_X; + new_bar_in_shell(p, p_max_size, get_battery_perct_bar(obj->data.s) / 2.55, obj->a); +#ifdef X11 + } +#endif /* X11 */ + } OBJ(battery_short) { get_battery_short_status(p, p_max_size, obj->data.s); } diff --git a/src/text_object.h b/src/text_object.h index 6d50f223..cd4e329f 100644 --- a/src/text_object.h +++ b/src/text_object.h @@ -55,9 +55,7 @@ enum text_object_type { OBJ_battery, OBJ_battery_time, OBJ_battery_percent, -#ifdef X11 OBJ_battery_bar, -#endif /* X11 */ OBJ_battery_short, #endif /* !__OpenBSD__ */ OBJ_buffers,