diff --git a/ChangeLog b/ChangeLog index 841006b3..e06dcd16 100644 --- a/ChangeLog +++ b/ChangeLog @@ -3,6 +3,8 @@ http://git.omp.am/?p=conky.git;a=summary and you can clone the repo with: git clone git://git.omp.am/conky.git * Fix for wrong usage of strncat (thanks Pavol) + * Adds a variable if_xmms2_connected to hide objects when xmms2d is not + running (thanks Lassi) 2008-12-06 * Removed duplicate sanity check for diskio diff --git a/doc/variables.xml b/doc/variables.xml index 9b13cbba..8029ba78 100644 --- a/doc/variables.xml +++ b/doc/variables.xml @@ -2461,6 +2461,14 @@ Prints the song name in either the form "artist - title" or file name, depending on whats available + + + + + + Display everything between $if_xmms2_connected and the matching $endif if xmms2 is running. + + diff --git a/src/conky.c b/src/conky.c index 684ed57f..eb10eaa5 100644 --- a/src/conky.c +++ b/src/conky.c @@ -1358,6 +1358,7 @@ enum text_object_type { OBJ_xmms2_smart, OBJ_xmms2_playlist, OBJ_xmms2_timesplayed, + OBJ_if_xmms2_connected, #endif #ifdef AUDACIOUS OBJ_audacious_status, @@ -4041,6 +4042,13 @@ static struct text_object *construct_text_object(const char *s, END OBJ(xmms2_smart, INFO_XMMS2) END OBJ(xmms2_playlist, INFO_XMMS2) END OBJ(xmms2_timesplayed, INFO_XMMS2) + END OBJ(if_xmms2_connected, INFO_XMMS2) + if (blockdepth >= MAX_IF_BLOCK_DEPTH) { + CRIT_ERR("MAX_IF_BLOCK_DEPTH exceeded"); + } + blockstart[blockdepth] = object_count; + obj->data.ifblock.pos = object_count + 2; + blockdepth++; #endif #ifdef AUDACIOUS END OBJ(audacious_status, INFO_AUDACIOUS) @@ -6216,6 +6224,14 @@ static void generate_text_internal(char *p, int p_max_size, cur->xmms2.title); } } + OBJ(if_xmms2_connected) { + if (cur->xmms2_conn_state == 1) { + if_jumped = 0; + } else { + i = obj->data.ifblock.pos; + if_jumped = 1; + } + } #endif #ifdef AUDACIOUS OBJ(audacious_status) {