diff options
Diffstat (limited to '')
-rw-r--r-- | src/conf.c | 8 | ||||
-rw-r--r-- | src/options.c | 1 | ||||
-rw-r--r-- | src/options.h | 1 | ||||
-rw-r--r-- | src/screen_utils.c | 21 |
4 files changed, 23 insertions, 8 deletions
diff --git a/src/conf.c b/src/conf.c index 0069489fa..8cf4f5b3a 100644 --- a/src/conf.c +++ b/src/conf.c @@ -53,12 +53,14 @@ #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" @@ -515,6 +517,12 @@ read_rc_file(char *filename, options_t *options) 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 e958e4b95..0aa812204 100644 --- a/src/options.c +++ b/src/options.c @@ -175,6 +175,7 @@ options_init( void ) 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 0034cecb5..5bc24f38d 100644 --- a/src/options.h +++ b/src/options.h @@ -11,6 +11,7 @@ typedef struct 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 c5efc8e7d..c9abc7b1f 100644 --- a/src/screen_utils.c +++ b/src/screen_utils.c @@ -216,14 +216,19 @@ set_xterm_title(char *format, ...) /* 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; } } |