1
0
forked from pool/mutt
mutt/patch-1.5.5.1.nt.xtitles.3.ab.1
OBS User autobuild 4422a49318 Accepting request 23900 from server:mail
Copy from server:mail/mutt based on submit request 23900 from user dirkmueller

OBS-URL: https://build.opensuse.org/request/show/23900
OBS-URL: https://build.opensuse.org/package/show/openSUSE:Factory/mutt?expand=0&rev=19
2009-11-10 11:34:34 +00:00

164 lines
5.4 KiB
Groff

Index: mutt-1.5.20/PATCHES
===================================================================
--- mutt-1.5.20.orig/PATCHES
+++ mutt-1.5.20/PATCHES
@@ -1 +1,2 @@
patch-1.5.19.rr.compressed.1
+patch-1.5.5.1.nt.xtitles.3.ab.1
Index: mutt-1.5.20/curs_main.c
===================================================================
--- mutt-1.5.20.orig/curs_main.c
+++ mutt-1.5.20/curs_main.c
@@ -110,6 +110,19 @@ static const char *No_visible = N_("No v
extern size_t UngetCount;
+#define ASCII_CTRL_G 0x07
+#define ASCII_CTRL_OPEN_SQUARE_BRAKET 0x1b
+
+void set_xterm_title_bar(char *title)
+{
+ fprintf(stderr ,"%c]2;%s%c", ASCII_CTRL_OPEN_SQUARE_BRAKET, title, ASCII_CTRL_G);
+}
+
+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;
@@ -566,6 +579,13 @@ int mutt_index_menu (void)
SETCOLOR (MT_COLOR_NORMAL);
BKGDSET (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;
Index: mutt-1.5.20/globals.h
===================================================================
--- mutt-1.5.20.orig/globals.h
+++ mutt-1.5.20/globals.h
@@ -141,6 +141,8 @@ WHERE char *Tempdir;
WHERE char *Tochars;
WHERE char *Username;
WHERE char *Visual;
+WHERE char *XtermTitle;
+WHERE char *XtermIcon;
WHERE char *CurrentFolder;
WHERE char *LastFolder;
Index: mutt-1.5.20/init.c
===================================================================
--- mutt-1.5.20.orig/init.c
+++ mutt-1.5.20/init.c
@@ -1833,6 +1833,26 @@ static int parse_set (BUFFER *tmp, BUFFE
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_strncasecmp (ep, "xterm", 5) &&
+ mutt_strncasecmp (ep, "color-xterm", 11) &&
+ mutt_strncasecmp (ep, "eterm", 5) &&
+ mutt_strncasecmp (ep, "kterm", 5) &&
+ mutt_strncasecmp (ep, "nxterm", 6) &&
+ mutt_strncasecmp (ep, "putty", 5) &&
+ mutt_strncasecmp (ep, "screen", 6) &&
+ mutt_strncasecmp (ep, "cygwin", 6) &&
+ mutt_strncasecmp (ep, "rxvt", 4) )
+ unset_option (MuttVars[idx]. data);
+
+ }
}
else if (myvar || DTYPE (MuttVars[idx].type) == DT_STR ||
DTYPE (MuttVars[idx].type) == DT_PATH ||
Index: mutt-1.5.20/init.h
===================================================================
--- mutt-1.5.20.orig/init.h
+++ mutt-1.5.20/init.h
@@ -3348,6 +3348,27 @@ struct option_t MuttVars[] = {
** Also see the $$read_inc, $$net_inc and $$time_inc variables and the
** ``$tuning'' section of the manual for performance considerations.
*/
+ {"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, 0, 0, 0, 0 }
};
Index: mutt-1.5.20/mutt.h
===================================================================
--- mutt-1.5.20.orig/mutt.h
+++ mutt-1.5.20/mutt.h
@@ -452,6 +452,7 @@ enum
OPTWRAPSEARCH,
OPTWRITEBCC, /* write out a bcc header? */
OPTXMAILER,
+ OPTXTERMSETTITLES,
OPTCRYPTUSEGPGME,
OPTCRYPTUSEPKA,
Index: mutt-1.5.20/pager.c
===================================================================
--- mutt-1.5.20.orig/pager.c
+++ mutt-1.5.20/pager.c
@@ -1784,6 +1784,13 @@ mutt_pager (const char *banner, const ch
}
BKGDSET (MT_COLOR_NORMAL);
SETCOLOR (MT_COLOR_NORMAL);
+ if (option(OPTXTERMSETTITLES))
+ {
+ menu_status_line (buffer, sizeof (buffer), index, NONULL (XtermTitle));
+ set_xterm_title_bar(buffer);
+ menu_status_line (buffer, sizeof (buffer), index, NONULL (XtermIcon));
+ set_xterm_icon_name(buffer);
+ }
}
if ((redraw & REDRAW_INDEX) && index)
Index: mutt-1.5.20/mutt_menu.h
===================================================================
--- mutt-1.5.20.orig/mutt_menu.h
+++ mutt-1.5.20/mutt_menu.h
@@ -112,4 +112,7 @@ int mutt_menuLoop (MUTTMENU *);
void index_make_entry (char *, size_t, struct menu_t *, int);
int index_color (int);
+void set_xterm_title_bar(char *);
+void set_xterm_icon_name(char *);
+
#endif /* _MUTT_MENU_H_ */