diff -urN mutt-1.2/curs_main.c mutt-1.2-ro/curs_main.c --- mutt-1.2/curs_main.c Sat Apr 22 09:25:20 2000 +++ mutt-1.2-ro/curs_main.c Mon Jun 19 12:50:46 2000 @@ -90,6 +90,19 @@ extern const char *ReleaseDate; +#define ASCII_CTRL_G 0x07 +#define ASCII_CTRL_OPEN_SQUARE_BRAKET 0x1b + +static void set_xterm_title_bar(char *title) +{ +fprintf(stderr ,"%c]2;%s%c", ASCII_CTRL_OPEN_SQUARE_BRAKET, title, ASCII_CTRL_G); +} + +static void set_xterm_icon_name(char *name) +{ +fprintf(stderr, "%c]1;%s%c", ASCII_CTRL_OPEN_SQUARE_BRAKET, name, ASCII_CTRL_G); +} + void index_make_entry (char *s, size_t l, MUTTMENU *menu, int num) { format_flag flag = M_FORMAT_MAKEPRINT | M_FORMAT_ARROWCURSOR | M_FORMAT_INDEX; @@ -524,6 +537,13 @@ printw ("%-*.*s", COLS, COLS, buf); SETCOLOR (MT_COLOR_NORMAL); menu->redraw &= ~REDRAW_STATUS; + if (option(OPTXTERMSETTITLES)) + { + menu_status_line (buf, sizeof (buf), menu, NONULL (XtermTitle)); + set_xterm_title_bar(buf); + menu_status_line (buf, sizeof (buf), menu, NONULL (XtermIcon)); + set_xterm_icon_name(buf); + } } menu->redraw = 0; diff -urN mutt-1.2/globals.h mutt-1.2-ro/globals.h --- mutt-1.2/globals.h Fri Mar 3 10:10:08 2000 +++ mutt-1.2-ro/globals.h Mon Jun 19 12:52:15 2000 @@ -95,6 +95,8 @@ WHERE char *Tochars; WHERE char *Username; WHERE char *Visual; +WHERE char *XtermTitle; +WHERE char *XtermIcon; WHERE char *LastFolder; diff -urN mutt-1.2/init.c mutt-1.2-ro/init.c --- mutt-1.2/init.c Sat Apr 22 10:27:07 2000 +++ mutt-1.2-ro/init.c Mon Jun 19 12:53:30 2000 @@ -831,6 +831,17 @@ toggle_option (MuttVars[idx].data); else set_option (MuttVars[idx].data); + + /* sanity check for xterm */ + if ((mutt_strcmp (MuttVars[idx].option, "xterm_set_titles") == 0) && option + (OPTXTERMSETTITLES)) + { + char *ep = getenv ("TERM"); + /* Make sure that the terminal can take the control codes */ + if (ep == NULL) unset_option (MuttVars[idx].data); + else if (mutt_strcasecmp (ep, "xterm") != 0) unset_option (MuttVars[idx]. +data); + } } else if (DTYPE (MuttVars[idx].type) == DT_STR || DTYPE (MuttVars[idx].type) == DT_PATH || diff -urN mutt-1.2/init.h mutt-1.2-ro/init.h --- mutt-1.2/init.h Wed Apr 26 08:32:40 2000 +++ mutt-1.2-ro/init.h Mon Jun 19 12:55:25 2000 @@ -2111,6 +2111,27 @@ ** Controls whether mutt writes out the Bcc header when preparing ** messages to be sent. Exim users may wish to use this. */ + {"xterm_icon", DT_STR, R_BOTH, UL &XtermIcon, UL "M%?n?AIL&ail?"}, + /* + ** .pp + ** Controls the format of the icon title, as long as xterm_set_titles + ** is enabled. This string is identical in formatting to the one used by + ** ``$$status_format''. + */ + {"xterm_set_titles", DT_BOOL, R_BOTH, OPTXTERMSETTITLES, 0}, + /* + ** .pp + ** Controls whether mutt sets the xterm title bar and icon name + ** (as long as you're in an appropriate terminal). The default must + ** be off to force in the validity checking. + */ + {"xterm_title", DT_STR, R_BOTH, UL &XtermTitle, UL "Mutt with %?m?%m messages&no messages?%?n? [%n NEW]?"}, + /* + ** .pp + ** Controls the format of the title bar of the xterm provided that + ** xterm_set_titles has been set. This string is identical in formatting + ** to the one used by ``$$status_format''. + */ /*--*/ { NULL } }; diff -urN mutt-1.2/mutt.h mutt-1.2-ro/mutt.h --- mutt-1.2/mutt.h Wed Apr 26 08:32:40 2000 +++ mutt-1.2-ro/mutt.h Mon Jun 19 12:56:18 2000 @@ -354,6 +354,7 @@ OPTWRAPSEARCH, OPTWRITEBCC, /* write out a bcc header? */ OPTXMAILER, + OPTXTERMSETTITLES, /* PGP options */