changing xterm title to mailbox name
Hello,
changing mailboxes with mutt can be slow, if you're talking
about mailboxes with 1000's of messages.
so i open multiples instances of mutt to look at differents folders.
(btw, i'm using maildir with hcache)
now, i've several xterm with a mutt inside.
i'm also using fvwmtabs (http://users.tpg.com.au/users/scottie7/fvwmtabs.html)
for easy switch between xterms.
i've been playing around the possibility of changing the xterm title
with mutt.
looks like mutt can't export arbitrary variables to <shell-escape> commands ?
anyway, i tried something like !echo -n "\033]0;$@\007"
didn't work, it wasn't interpreted.
calling it from a shell maybe ?
(without a macro, didn't worked)
macro index -t "<shell-escape>/usr/bin/zsh xterm_set_title
debian-bugs-dist.lists.debian.org\n"
(sh didn't work for me)
folder-hook on that :
folder-hook debian-bugs-dist.lists.debian.org "push -t"
now great, i can set it.
but macros aren't longer than 8 chars.
so if i have a macro called -debian-security-lists
and another -debian-security-announnce,
truncating to 8 chars doesn't work.
... md5sum to the rescue !
script shell to generate the macro for each list :
--------------------
for i in `cat .lists`
do
listname=`echo $i | sed 's:@.*::g'`
listdomain=`echo $i | sed 's:.*@::g'`
listmd5=`echo $i|md5sum|perl -pe 's/^(\w{7}).*/$1/'`
echo macro index -$listmd5 \"\<shell-escape\>/usr/bin/zsh
~/system/bin/xterm_set_title $listname.$listdomain\\n\"
echo folder-hook $listname.$listdomain \"push -$listmd5\"
echo folder-hook $listname.$listdomain set wait_key=no
done > ~/.mutt.lists
--------------------
$ cat ~/system/bin/xterm_set_title
#!/bin/zsh
echo -n "\033]0;$@\007"
--------------------
(which means my lists are sorted in mailboxes like mutt-users.mutt.org)
that gives : (for example)
macro index -26e7fe0 "<shell-escape>/usr/bin/zsh
/home/xavier/system/bin/xterm_set_title
spamassassin-talk.lists.sourceforge.net\n"
folder-hook spamassassin-talk.lists.sourceforge.net "push -26e7fe0"
i'd like to know if there a better way to do it ?
performance is ok, but i'm bothered about forking a shell each time i open a new
mailbox
thanks
--
xavier