diff --git a/ChangeLog b/ChangeLog index be76169b..7059a63b 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,5 +1,10 @@ # $Id$ +2007-09-01 + * Improved performance slightly + * Added 'mpd_interval' config option to specify an update interval for the + mpd thread + 2007-08-31 * _Really_ fix mpd SIGPIPE issues * Fix timed thread race condition, seen esp. on new kernel scheduler (cfs). diff --git a/doc/config_settings.xml b/doc/config_settings.xml index 5c61c9ae..7f3a01a6 100644 --- a/doc/config_settings.xml +++ b/doc/config_settings.xml @@ -269,6 +269,13 @@ + + + + MPD thread update interval (defaults to Conky's update interval) + + + diff --git a/src/common.c b/src/common.c index 1b5c5157..1bb7eb11 100644 --- a/src/common.c +++ b/src/common.c @@ -234,7 +234,7 @@ void update_stuff() if (NEED(INFO_MPD)) { if (!mpd_timed_thread) { init_mpd_stats(&info); - mpd_timed_thread = timed_thread_create((void*)update_mpd, (void*) NULL, update_interval * 1000000); + mpd_timed_thread = timed_thread_create((void*)update_mpd, (void*) NULL, info.mpd.interval * 1000000); if (!mpd_timed_thread) { ERR("Failed to create MPD timed thread"); } diff --git a/src/conky.c b/src/conky.c index 036aa20c..fec87120 100644 --- a/src/conky.c +++ b/src/conky.c @@ -687,7 +687,6 @@ static void new_font(char *buf, char * args) { struct special_t *s = new_special(buf, FONT); int tmp = selected_font; selected_font = s->font_added = 0; - load_fonts(); selected_font = tmp; } } @@ -1113,6 +1112,7 @@ enum text_object_type { OBJ_mpd_host, OBJ_mpd_port, OBJ_mpd_password, + OBJ_mpd_interval, OBJ_mpd_bar, OBJ_mpd_elapsed, OBJ_mpd_length, @@ -3878,9 +3878,7 @@ static void generate_text_internal(char *p, int p_max_size, struct text_object * #endif /* __OpenBSD__ */ OBJ(font) { -#ifdef X11 new_font(p, obj->data.s); -#endif /* X11 */ } void format_diskio(unsigned int diskio_value) { @@ -6814,9 +6812,9 @@ static void set_default_configurations(void) own_window = 0; window.type=TYPE_NORMAL; window.hints=0; - strcpy(window.class_name, "Conky"); - update_uname(); - sprintf(window.title,"%s - conky",info.uname_s.nodename); + strcpy(window.class_name, "Conky"); + update_uname(); + sprintf(window.title,"%s - conky",info.uname_s.nodename); #endif stippled_borders = 0; border_margin = 3; @@ -7050,6 +7048,12 @@ else if (strcasecmp(name, a) == 0 || strcasecmp(name, b) == 0) else CONF_ERR; } + CONF("mpd_interval") { + if (value) + info.mpd.interval = strtod(value, 0); + else + CONF_ERR; + } #endif #ifdef __OpenBSD__ CONF("sensor_device") { @@ -7318,6 +7322,12 @@ else if (strcasecmp(name, a) == 0 || strcasecmp(name, b) == 0) update_interval = strtod(value, 0); else CONF_ERR; +#ifdef MPD + if (info.mpd.interval == 0) { + // default to update_interval + info.mpd.interval = update_interval; + } +#endif /* MPD */ } CONF("total_run_times") { if (value) @@ -7404,6 +7414,12 @@ else if (strcasecmp(name, a) == 0 || strcasecmp(name, b) == 0) fclose(fp); #undef CONF_ERR +#ifdef MPD + if (info.mpd.interval == 0) { + // default to update_interval + info.mpd.interval = update_interval; + } +#endif /* MPD */ } @@ -7608,6 +7624,12 @@ int main(int argc, char **argv) case 'u': update_interval = strtod(optarg, 0); +#ifdef MPD + if (info.mpd.interval == 0) { + // default to update_interval + info.mpd.interval = update_interval; + } +#endif /* MPD */ break; case 'i': diff --git a/src/conky.h b/src/conky.h index 4efa69b3..b46ece0d 100644 --- a/src/conky.h +++ b/src/conky.h @@ -177,6 +177,7 @@ struct mpd_s { unsigned int port; char host[128]; char password[128]; + double interval; float progress; int bitrate; int length;