From: Yoshiki Vázquez Baeza Date: Sun, 7 Jan 2018 13:49:45 +0000 (+0100) Subject: NewMailCmd: optionally execute a command upon new mail arrival X-Git-Tag: mutt-1-10-rel~91 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=2f39cf2aa1e023de93067af31df0a2af5ecc5c93;p=mutt NewMailCmd: optionally execute a command upon new mail arrival This setting allows to run any external program to e.g. produce a notification on the desktop when Mutt finds new mail. Signed-off-by: Fabian Groffen --- diff --git a/curs_main.c b/curs_main.c index 19e39051..b2c18cad 100644 --- a/curs_main.c +++ b/curs_main.c @@ -636,6 +636,12 @@ int mutt_index_menu (void) mutt_message _("New mail in this mailbox."); if (option (OPTBEEPNEW)) beep (); + if (NewMailCmd) + { + char cmd[LONG_STRING]; + menu_status_line(cmd, sizeof(cmd), menu, NONULL(NewMailCmd)); + mutt_system(cmd); + } } else if (check == MUTT_FLAGS) mutt_message _("Mailbox was externally modified."); @@ -662,6 +668,12 @@ int mutt_index_menu (void) menu->redraw |= REDRAW_STATUS; if (option (OPTBEEPNEW)) beep(); + if (NewMailCmd) + { + char cmd[LONG_STRING]; + menu_status_line(cmd, sizeof(cmd), menu, NONULL(NewMailCmd)); + mutt_system(cmd); + } } } else diff --git a/globals.h b/globals.h index 9634691a..61b95157 100644 --- a/globals.h +++ b/globals.h @@ -115,6 +115,7 @@ WHERE char *Postponed; WHERE char *PostponeEncryptAs; WHERE char *Prefix; WHERE char *PrintCmd; +WHERE char *NewMailCmd; WHERE char *QueryCmd; WHERE char *QueryFormat; WHERE char *Realname; diff --git a/init.h b/init.h index 13505a21..d99a2571 100644 --- a/init.h +++ b/init.h @@ -1800,6 +1800,13 @@ struct option_t MuttVars[] = { ** See also $$read_inc, $$write_inc and $$net_inc. */ #endif + { "new_mail_command", DT_PATH, R_NONE, UL &NewMailCmd, UL NULL }, + /* + ** .pp + ** If \fIset\fP, Mutt will call this command after a new message is received. + ** See the $$status_format documentation for the values that can be formatted + ** into this command. + */ { "pager", DT_PATH, R_NONE, UL &Pager, UL "builtin" }, /* ** .pp