summary | shortlog | log | commit | commitdiff | tree
raw | patch | inline | side by side (parent: b0353fc)
raw | patch | inline | side by side (parent: b0353fc)
author | Kalle Wallin <kaw@linux.se> | |
Thu, 24 Jun 2004 16:12:51 +0000 (16:12 +0000) | ||
committer | Kalle Wallin <kaw@linux.se> | |
Thu, 24 Jun 2004 16:12:51 +0000 (16:12 +0000) |
src/main.c | patch | blob | history |
diff --git a/src/main.c b/src/main.c
index f42a2b01c7f221514181a28b2639a6e6e9c3892e..bc607da81ab74134a14c327f371feeeabd151761 100644 (file)
--- a/src/main.c
+++ b/src/main.c
#include "command.h"
#include "screen.h"
#include "screen_utils.h"
+#include "strfsong.h"
-#define BUFSIZE 256
+#define BUFSIZE 1024
static mpdclient_t *mpd = NULL;
static gboolean connected = FALSE;
}
}
+static void
+update_xterm_title(void)
+{
+ static char title[BUFSIZE];
+ char tmp[BUFSIZE];
+ mpd_Status *status = NULL;
+ mpd_Song *song = NULL;
+
+ if( mpd )
+ {
+ status = mpd->status;
+ song = mpd->song;
+ }
+
+ if(options.xterm_title_format && status && song && IS_PLAYING(status->state))
+ {
+ strfsong(tmp, BUFSIZE, options.xterm_title_format, song);
+ }
+ else
+ strncpy(tmp, PACKAGE " version " VERSION, BUFSIZE);
+
+ if( strcmp(title,tmp) )
+ {
+ strncpy(title, tmp, BUFSIZE);
+ fprintf(stderr, "%s\n", title);
+ set_xterm_title(title);
+ }
+}
+
void
exit_and_cleanup(void)
{
exit(EXIT_FAILURE);
}
- /* set xterm title */
- set_xterm_title(PACKAGE " version " VERSION);
-
/* install exit function */
atexit(exit_and_cleanup);
}
doupdate();
}
-
+ if( options->enable_xterm_title )
+ update_xterm_title();
t = g_timer_elapsed(timer, NULL);
}
exit(EXIT_FAILURE);