diff --git a/src/conky.c b/src/conky.c index 802e0aad..fc1cd6f0 100644 --- a/src/conky.c +++ b/src/conky.c @@ -915,6 +915,7 @@ enum text_object_type { OBJ_infopipe_channels, OBJ_infopipe_title, OBJ_infopipe_file, + OBJ_infopipe_bar, #endif #ifdef TCP_PORT_MONITOR OBJ_tcp_portmon, @@ -1839,6 +1840,7 @@ int a = stippled_borders, b = 1; OBJ(infopipe_channels, INFO_INFOPIPE) END OBJ(infopipe_title, INFO_INFOPIPE) END OBJ(infopipe_file, INFO_INFOPIPE) END + OBJ(infopipe_bar, INFO_INFOPIPE) END #endif #ifdef TCP_PORT_MONITOR OBJ(tcp_portmon, INFO_TCP_PORT_MONITOR) @@ -3158,6 +3160,12 @@ static void generate_text_internal(char *p, int p_max_size, struct text_object * OBJ(infopipe_file) { snprintf(p, p_max_size, "%s", cur->infopipe.items[INFOPIPE_FILE]); } + OBJ(infopipe_bar) { + double progress; + progress= atof(cur->infopipe.items[INFOPIPE_USEC_POSITION]) / + atof(cur->infopipe.items[INFOPIPE_USEC_TIME]); + new_bar(p,obj->a,obj->b,(int)(progress*255.0f)); + } #endif OBJ(top) { if (obj->data.top.type == TOP_NAME diff --git a/src/infopipe.c b/src/infopipe.c index 6a01f0bd..ef93ad95 100644 --- a/src/infopipe.c +++ b/src/infopipe.c @@ -69,7 +69,7 @@ void *infopipe_thread_func(void *pvoid) pvoid=(void*)pvoid; /* useless cast to avoid unused var warning */ /* I/O multiplexing timer */ - tm.tv_sec=10; /* high enough to reduce persistent select() failures */ + tm.tv_sec=30; /* high enough to reduce persistent select() failures */ tm.tv_usec=0; /* Grab the runnable signal. Should be non-zero here or we do nothing. */ @@ -96,7 +96,7 @@ void *infopipe_thread_func(void *pvoid) ideally suited for a worker thread such as this. We don't want to slow down ui updates in the main thread as there is already excess latency there. */ - if ((i=select(fd+1,&readset,NULL,NULL,&tm)) == 1) { /* something to read */ + if (select(fd+1,&readset,NULL,NULL,&tm) == 1) { /* something to read */ if (read(fd,buf,sizeof(buf)) > 0) { /* buf has data */ @@ -113,9 +113,6 @@ void *infopipe_thread_func(void *pvoid) */ } } - else { - printf("select() says nothing to read: %d, fd %d\n",i,fd); - } if (close(fd) < 0) { break;