summary | shortlog | log | commit | commitdiff | tree
raw | patch | inline | side by side (parent: 31e6fa7)
raw | patch | inline | side by side (parent: 31e6fa7)
author | Kalle Wallin <kaw@linux.se> | |
Thu, 24 Jun 2004 16:08:24 +0000 (16:08 +0000) | ||
committer | Kalle Wallin <kaw@linux.se> | |
Thu, 24 Jun 2004 16:08:24 +0000 (16:08 +0000) |
doc/config.sample | patch | blob | history | |
doc/ncmpc.1 | patch | blob | history | |
src/conf.c | patch | blob | history | |
src/options.c | patch | blob | history | |
src/options.h | patch | blob | history | |
src/screen_utils.c | patch | blob | history |
diff --git a/doc/config.sample b/doc/config.sample
index 755068dcc6f62bca31f6d70321160d1fbada3075..0630296d5bc3c99a7d21bb1513b6f29eceb36692 100644 (file)
--- a/doc/config.sample
+++ b/doc/config.sample
## change the xterm title
#set-xterm-title = no
+## xterm title format
+#xterm-title-format = "ncmpc: [ %name%|[%artist% - ]%title%|%file%]"
+
##
## Color configuration
##
diff --git a/doc/ncmpc.1 b/doc/ncmpc.1
index ac3a65a2136448adcd3ab1246caec11bfb16da6b..7e83ea6c642c2c2ec4c9ed47a4c0a7e1dd36e3fa 100644 (file)
--- a/doc/ncmpc.1
+++ b/doc/ncmpc.1
.B visible\-bell = yes|no
Visible bell on alerts.
.TP
-.B set\-xterm\-title = yes|no
-Change the XTerm title (ncmpc will not restore the title).
-.TP
.B list\-format = SONG FORMAT
The format used to display songs in the main window.
.TP
.B status\-format = SONG FORMAT
The format used to display songs on the status line.
.TP
+.B set\-xterm\-title = yes|no
+Change the XTerm title (ncmpc will not restore the title).
+.TP
+.B xterm\-title\-format = SONG FORMAT
+The format used to for the xterm title when ncmpc is playing.
+.TP
.B enable\-colors = yes|no
Enable/disable colors.
.TP
diff --git a/src/conf.c b/src/conf.c
index 0069489fa08856f2bf9aae46c64be9a28ef70f37..8cf4f5b3a9049fa6b8f67d2062aed40a5b9a9348 100644 (file)
--- a/src/conf.c
+++ b/src/conf.c
#define CONF_COLOR_DEFINITION "colordef"
#define CONF_LIST_FORMAT "list-format"
#define CONF_STATUS_FORMAT "status-format"
+#define CONF_XTERM_TITLE_FORMAT "xterm-title-format"
#define CONF_LIST_WRAP "wrap-around"
#define CONF_FIND_WRAP "find-wrap"
#define CONF_AUDIBLE_BELL "audible-bell"
#define CONF_VISIBLE_BELL "visible-bell"
#define CONF_XTERM_TITLE "set-xterm-title"
+
/* Deprecated - configuration field names */
#define OLD_CONF_ENABLE_COLORS "enable_colors"
#define OLD_CONF_AUTO_CENTER "auto_center"
g_free(options->status_format);
options->status_format = get_format(value);
}
+ /* xterm title format string */
+ else if( !strcasecmp(CONF_XTERM_TITLE_FORMAT, name) )
+ {
+ g_free(options->xterm_title_format);
+ options->xterm_title_format = get_format(value);
+ }
else if( !strcasecmp(CONF_LIST_WRAP, name) )
{
options->list_wrap = str2bool(value);
diff --git a/src/options.c b/src/options.c
index e958e4b957531a96cfcc2c39161b84d8569fc6b5..0aa812204554b1230988fe78948b553834b323ff 100644 (file)
--- a/src/options.c
+++ b/src/options.c
options.list_format = NULL;
options.status_format = NULL;
+ options.xterm_title_format = NULL;
options.reconnect = TRUE;
options.find_wrap = TRUE;
diff --git a/src/options.h b/src/options.h
index 0034cecb5d3a2be0b96f8c91e7de1de14c9117c4..5bc24f38d156a037f2444b2a49b0093f42dd0939 100644 (file)
--- a/src/options.h
+++ b/src/options.h
char *key_file;
char *list_format;
char *status_format;
+ char *xterm_title_format;
int port;
gboolean reconnect;
gboolean debug;
diff --git a/src/screen_utils.c b/src/screen_utils.c
index c5efc8e7dfdde993e361beab4f5ede6bc9c79234..c9abc7b1f78a563cbd188006bb17e48d88b2bde8 100644 (file)
--- a/src/screen_utils.c
+++ b/src/screen_utils.c
/* the current xterm title exists under the WM_NAME property */
/* and can be retreived with xprop -id $WINDOWID */
- if( options.enable_xterm_title && g_getenv("WINDOWID") )
+ if( options.enable_xterm_title )
{
- char buffer[512];
- va_list ap;
-
- va_start(ap,format);
- vsnprintf(buffer,sizeof(buffer),format,ap);
- va_end(ap);
- printf("%c]0;%s%c", '\033', buffer, '\007');
+ if( g_getenv("WINDOWID") )
+ {
+ char buffer[512];
+ va_list ap;
+
+ va_start(ap,format);
+ vsnprintf(buffer,sizeof(buffer),format,ap);
+ va_end(ap);
+ printf("%c]0;%s%c", '\033', buffer, '\007');
+ }
+ else
+ options.enable_xterm_title = FALSE;
}
}