/* border */
static int draw_borders;
+static int draw_graph_borders;
static int stippled_borders;
static int draw_shades, draw_outline;
OBJ_mpd_track,
OBJ_mpd_percent,
#endif
+#ifdef AUDACIOUS
+ OBJ_audacious_status,
+ OBJ_audacious_song,
+ OBJ_audacious_song_length,
+ OBJ_audacious_song_length_seconds,
+ OBJ_audacious_song_length_frames,
+ OBJ_audacious_song_output_length,
+ OBJ_audacious_song_output_length_seconds,
+ OBJ_audacious_song_output_length_frames,
+ OBJ_audacious_song_bitrate,
+ OBJ_audacious_song_frequency,
+ OBJ_audacious_song_channels,
+ OBJ_audacious_bar,
+#endif
#ifdef BMPX
OBJ_bmpx_title,
OBJ_bmpx_artist,
OBJ_infopipe_channels,
OBJ_infopipe_title,
OBJ_infopipe_file,
+ OBJ_infopipe_bar,
#endif
#ifdef TCP_PORT_MONITOR
OBJ_tcp_portmon,
(void) scan_bar(arg, &obj->data.pair.a, &obj->data.pair.b);
END
#endif
+#ifdef AUDACIOUS
+ OBJ(audacious_status, INFO_AUDACIOUS) END
+ OBJ(audacious_song, INFO_AUDACIOUS) END
+ OBJ(audacious_song_length, INFO_AUDACIOUS) END
+ OBJ(audacious_song_length_seconds, INFO_AUDACIOUS) END
+ OBJ(audacious_song_length_frames, INFO_AUDACIOUS) END
+ OBJ(audacious_song_output_length, INFO_AUDACIOUS) END
+ OBJ(audacious_song_output_length_seconds, INFO_AUDACIOUS) END
+ OBJ(audacious_song_output_length_frames, INFO_AUDACIOUS) END
+ OBJ(audacious_song_bitrate, INFO_AUDACIOUS) END
+ OBJ(audacious_song_frequency, INFO_AUDACIOUS) END
+ OBJ(audacious_song_channels, INFO_AUDACIOUS) END
+ OBJ(audacious_bar, INFO_AUDACIOUS)
+ (void) scan_bar(arg, &obj->a, &obj->b);
+ END
+#endif
#ifdef BMPX
OBJ(bmpx_title, INFO_BMPX)
+ memset(&(info.bmpx), 0, sizeof(struct bmpx_s));
END
OBJ(bmpx_artist, INFO_BMPX)
+ memset(&(info.bmpx), 0, sizeof(struct bmpx_s));
END
OBJ(bmpx_album, INFO_BMPX)
+ memset(&(info.bmpx), 0, sizeof(struct bmpx_s));
END
OBJ(bmpx_track, INFO_BMPX)
+ memset(&(info.bmpx), 0, sizeof(struct bmpx_s));
END
OBJ(bmpx_uri, INFO_BMPX)
+ memset(&(info.bmpx), 0, sizeof(struct bmpx_s));
END
OBJ(bmpx_bitrate, INFO_BMPX)
+ memset(&(info.bmpx), 0, sizeof(struct bmpx_s));
END
#endif
#ifdef INFOPIPE
OBJ(infopipe_channels, INFO_INFOPIPE) END
OBJ(infopipe_title, INFO_INFOPIPE) END
OBJ(infopipe_file, INFO_INFOPIPE) END
+ OBJ(infopipe_bar, INFO_INFOPIPE)
+ (void) scan_bar(arg, &obj->a, &obj->b);
+ END
#endif
#ifdef TCP_PORT_MONITOR
OBJ(tcp_portmon, INFO_TCP_PORT_MONITOR)
255.0f));
}
#endif
+#ifdef AUDACIOUS
+ OBJ(audacious_status) {
+ snprintf(p, p_max_size, "%s", cur->audacious.items[AUDACIOUS_STATUS]);
+ }
+ OBJ(audacious_song) {
+ snprintf(p, p_max_size, "%s", cur->audacious.items[AUDACIOUS_SONG]);
+ }
+ OBJ(audacious_song_length) {
+ snprintf(p, p_max_size, "%s", cur->audacious.items[AUDACIOUS_SONG_LENGTH]);
+ }
+ OBJ(audacious_song_length_seconds) {
+ snprintf(p, p_max_size, "%s", cur->audacious.items[AUDACIOUS_SONG_LENGTH_SECONDS]);
+ }
+ OBJ(audacious_song_length_frames) {
+ snprintf(p, p_max_size, "%s", cur->audacious.items[AUDACIOUS_SONG_LENGTH_FRAMES]);
+ }
+ OBJ(audacious_song_output_length) {
+ snprintf(p, p_max_size, "%s", cur->audacious.items[AUDACIOUS_SONG_OUTPUT_LENGTH]);
+ }
+ OBJ(audacious_song_output_length_seconds) {
+ snprintf(p, p_max_size, "%s", cur->audacious.items[AUDACIOUS_SONG_OUTPUT_LENGTH_SECONDS]);
+ }
+ OBJ(audacious_song_output_length_frames) {
+ snprintf(p, p_max_size, "%s", cur->audacious.items[AUDACIOUS_SONG_OUTPUT_LENGTH_FRAMES]);
+ }
+ OBJ(audacious_song_bitrate) {
+ snprintf(p, p_max_size, "%s", cur->audacious.items[AUDACIOUS_SONG_BITRATE]);
+ }
+ OBJ(audacious_song_frequency) {
+ snprintf(p, p_max_size, "%s", cur->audacious.items[AUDACIOUS_SONG_FREQUENCY]);
+ }
+ OBJ(audacious_song_channels) {
+ snprintf(p, p_max_size, "%s", cur->audacious.items[AUDACIOUS_STATUS]);
+ }
+ OBJ(audacious_bar) {
+ double progress;
+ progress= atof(cur->audacious.items[AUDACIOUS_SONG_OUTPUT_LENGTH_SECONDS]) /
+ atof(cur->audacious.items[AUDACIOUS_SONG_LENGTH_SECONDS]);
+ new_bar(p,obj->a,obj->b,(int)(progress*255.0f));
+
+ }
+#endif
#ifdef BMPX
OBJ(bmpx_title) {
snprintf(p, p_max_size, "%s", cur->bmpx.title);
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
OBJ(tail) {
- if (current_update_time -obj->data.tail.last_update >= obj->data.tail.interval) {
+ if (current_update_time -obj->data.tail.last_update < obj->data.tail.interval) {
+ snprintf(p, p_max_size, "%s", obj->data.tail.buffer);
+ } else {
obj->data.tail.last_update = current_update_time;
FILE *fp;
int i;
if (obj->data.tail.buffer[strlen(obj->data.tail.buffer)-1] == '\n') {
obj->data.tail.buffer[strlen(obj->data.tail.buffer)-1] = '\0';
}
+ snprintf(p, p_max_size, "%s", obj->data.tail.buffer);
freetail(freetmp);
} else {
strcpy(obj->data.tail.buffer, "Logfile Empty");
+ snprintf(p, p_max_size, "Logfile Empty");
} /* if readlines */
} /* fp == NULL */
} /* if cur_upd_time >= */
}
OBJ(head) {
- if (current_update_time -obj->data.tail.last_update >= obj->data.tail.interval) {
+ if (current_update_time -obj->data.tail.last_update < obj->data.tail.interval) {
+ snprintf(p, p_max_size, "%s", obj->data.tail.buffer);
+ } else {
obj->data.tail.last_update = current_update_time;
FILE *fp;
tailstring *head = NULL;
if (obj->data.tail.buffer[strlen(obj->data.tail.buffer)-1] == '\n') {
obj->data.tail.buffer[strlen(obj->data.tail.buffer)-1] = '\0';
}
+ snprintf(p, p_max_size, "%s", obj->data.tail.buffer);
} else {
strcpy(obj->data.tail.buffer, "Logfile Empty");
+ snprintf(p, p_max_size, "Logfile Empty");
} /* if readlines > 0 */
} /* if fp == null */
} /* cur_upd_time >= */
w = text_start_x + text_width - cur_x - 1;
if (w < 0)
w = 0;
- XSetLineAttributes(display,
- window.gc, 1,
- LineSolid,
- CapButt,
- JoinMiter);
- XDrawRectangle(display,
- window.drawable,
- window.gc, cur_x,
- by, w, h);
+ if (draw_graph_borders) {
+ XSetLineAttributes(display, window.gc, 1, LineSolid, CapButt, JoinMiter);
+ XDrawRectangle(display,window.drawable, window.gc, cur_x, by, w, h);
+ }
XSetLineAttributes(display,
window.gc, 1,
LineSolid,
default_fg_color = WhitePixel(display, screen);
default_bg_color = BlackPixel(display, screen);
default_out_color = BlackPixel(display, screen);
- draw_borders = 0;
draw_shades = 1;
+ draw_borders = 0;
+ draw_graph_borders = 1;
draw_outline = 0;
set_first_font("6x10");
gap_x = 5;
CONF("draw_borders") {
draw_borders = string_to_bool(value);
}
+ CONF("draw_graph_borders") {
+ draw_graph_borders = string_to_bool(value);
+ }
CONF("draw_shades") {
draw_shades = string_to_bool(value);
}
ERR("error setting signal handler: %s", strerror(errno) );
}
+#ifdef AUDACIOUS
+ /* joinable thread for audacious activity */
+ pthread_attr_init(&info.audacious.thread_attr);
+ pthread_attr_setdetachstate(&info.audacious.thread_attr, PTHREAD_CREATE_JOINABLE);
+ /* init mutexex */
+ pthread_mutex_init(&info.audacious.item_mutex, NULL);
+ pthread_mutex_init(&info.audacious.runnable_mutex, NULL);
+ /* init runnable condition for worker thread */
+ pthread_mutex_lock(&info.audacious.runnable_mutex);
+ info.audacious.runnable=1;
+ pthread_mutex_unlock(&info.audacious.runnable_mutex);
+ if (pthread_create(&info.audacious.thread, &info.audacious.thread_attr, audacious_thread_func, NULL))
+ {
+ CRIT_ERR("unable to create audacious thread!");
+ }
+#endif
#ifdef INFOPIPE
/* joinable thread for infopipe activity */
pthread_attr_init(&info.infopipe.thread_attr);
#endif
main_loop();
-
+
+#ifdef AUDACIOUS
+ /* signal audacious worker thread to terminate */
+ pthread_mutex_lock(&info.audacious.runnable_mutex);
+ info.audacious.runnable=0;
+ pthread_mutex_unlock(&info.audacious.runnable_mutex);
+ /* destroy thread attribute and wait for thread */
+ pthread_attr_destroy(&info.audacious.thread_attr);
+ if (pthread_join(info.audacious.thread, NULL))
+ {
+ ERR("error joining audacious thread");
+ }
+ /* destroy mutexes */
+ pthread_mutex_destroy(&info.audacious.item_mutex);
+ pthread_mutex_destroy(&info.audacious.runnable_mutex);
+#endif
#ifdef INFOPIPE
/* signal infopipe worker thread to terminate */
pthread_mutex_lock(&info.infopipe.runnable_mutex);