1
0
mirror of https://github.com/Llewellynvdm/conky.git synced 2024-12-27 12:42:41 +00:00

Let battery_bar work in shell

This commit is contained in:
Nikolas Garofil 2009-06-02 19:16:21 +02:00
parent 1a9d0bdccd
commit 7807d369ad
2 changed files with 10 additions and 7 deletions

View File

@ -1338,7 +1338,6 @@ static struct text_object *construct_text_object(const char *s,
strcpy(bat, "BAT0"); strcpy(bat, "BAT0");
} }
obj->data.s = strndup(bat, text_buffer_size); obj->data.s = strndup(bat, text_buffer_size);
#ifdef X11
END OBJ(battery_bar, 0) END OBJ(battery_bar, 0)
char bat[64]; char bat[64];
SIZE_DEFAULTS(bar); SIZE_DEFAULTS(bar);
@ -1350,7 +1349,6 @@ static struct text_object *construct_text_object(const char *s,
strcpy(bat, "BAT0"); strcpy(bat, "BAT0");
} }
obj->data.s = strndup(bat, text_buffer_size); obj->data.s = strndup(bat, text_buffer_size);
#endif
#endif /* !__OpenBSD__ */ #endif /* !__OpenBSD__ */
#if defined(__linux__) #if defined(__linux__)
@ -3574,11 +3572,18 @@ static void generate_text_internal(char *p, int p_max_size,
OBJ(battery_percent) { OBJ(battery_percent) {
percent_print(p, p_max_size, get_battery_perct(obj->data.s)); percent_print(p, p_max_size, get_battery_perct(obj->data.s));
} }
#ifdef X11
OBJ(battery_bar) { OBJ(battery_bar) {
#ifdef X11
if(output_methods & TO_X) {
new_bar(p, obj->a, obj->b, get_battery_perct_bar(obj->data.s)); 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 */ #endif /* X11 */
}
OBJ(battery_short) { OBJ(battery_short) {
get_battery_short_status(p, p_max_size, obj->data.s); get_battery_short_status(p, p_max_size, obj->data.s);
} }

View File

@ -55,9 +55,7 @@ enum text_object_type {
OBJ_battery, OBJ_battery,
OBJ_battery_time, OBJ_battery_time,
OBJ_battery_percent, OBJ_battery_percent,
#ifdef X11
OBJ_battery_bar, OBJ_battery_bar,
#endif /* X11 */
OBJ_battery_short, OBJ_battery_short,
#endif /* !__OpenBSD__ */ #endif /* !__OpenBSD__ */
OBJ_buffers, OBJ_buffers,