here's a version of neil townsend's xterm patch that should work with
more recent versions.  i was able to do patch -p1 <patch in the
mutt-1.3.21 directory.

the only things that are really different are the line numbers.

-w

diff -u mutt-1.3.20/curs_main.c mutt-1.3.20-ro/curs_main.c
--- mutt-1.3.20/curs_main.c     Thu Jul 19 07:49:51 2001
+++ mutt-1.3.20-ro/curs_main.c  Thu Aug  9 05:47:28 2001
@@ -103,6 +103,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;
@@ -539,6 +552,13 @@
        mutt_paddstr (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 -u mutt-1.3.20/globals.h mutt-1.3.20-ro/globals.h
--- mutt-1.3.20/globals.h       Mon Jun 18 08:56:14 2001
+++ mutt-1.3.20-ro/globals.h    Thu Aug  9 05:48:00 2001
@@ -103,6 +103,9 @@
 WHERE char *Tochars;
 WHERE char *Username;
 WHERE char *Visual;
+WHERE char *XtermTitle;
+WHERE char *XtermIcon;
+
 
 WHERE char *LastFolder;
 
diff -u mutt-1.3.20/init.c mutt-1.3.20-ro/init.c
--- mutt-1.3.20/init.c  Tue Jul  3 12:31:16 2001
+++ mutt-1.3.20-ro/init.c       Thu Aug  9 05:51:02 2001
@@ -840,6 +840,16 @@
        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 -u mutt-1.3.20/init.h mutt-1.3.20-ro/init.h
--- mutt-1.3.20/init.h  Fri Jun 29 03:05:50 2001
+++ mutt-1.3.20-ro/init.h       Thu Aug  9 05:53:18 2001
@@ -2279,6 +2279,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 -u mutt-1.3.20/mutt.h mutt-1.3.20-ro/mutt.h
--- mutt-1.3.20/mutt.h  Fri Jun 29 03:05:50 2001
+++ mutt-1.3.20-ro/mutt.h       Thu Aug  9 05:53:45 2001
@@ -399,6 +399,7 @@
   OPTWRAPSEARCH,
   OPTWRITEBCC,         /* write out a bcc header? */
   OPTXMAILER,
+  OPTXTERMSETTITLES,
 
   /* PGP options */

-- 
Sintax error in config file! (line 378)
aborted!

PGP Public Key:
http://infinitejazz.net/will/pgp/

Reply via email to