Permalink
Browse files

Automatically pick the right mailbox

  • Loading branch information...
frioux committed Jan 24, 2017
1 parent b4b2d9e commit 0d08632c83792ac62b389de169c57b353c1b59cc
Showing with 16 additions and 13 deletions.
  1. +14 −11 bin/email-handler
  2. +1 −1 install-xdg
  3. +1 −1 xdg/{frew-email.desktop → frew-mid.desktop}
@@ -8,21 +8,24 @@ use autodie;
use File::Temp;

my $url = shift;
my $email = $url =~ s(^email://)()r;
my $id = $url =~ s(^mid:)()r;

my ($search, $which_email) = split /\.eml@/, $email;
my $dir = File::Temp->newdir;

{
my $dir = File::Temp->newdir;
for my $val (
[undef, ''],
["$ENV{HOME}/.zr-notmuch-config", 'zr-']
) {
$ENV{NOTMUCH_CONFIG} = $val->[0] if $val->[0];
my $mutt = $val->[1] . 'mutt';

my $mutt = 'mutt';
system qw(notmuch-mutt -r search), "id:$id", '-o', "$dir";

if ($which_email eq 'zr') {
$mutt = 'zr-mutt';
$ENV{NOTMUCH_CONFIG} = "$ENV{HOME}/.zr-notmuch-config";
}
next unless grep -f, glob "$dir/cur/*";

system qw(notmuch-mutt -r search), $search, '-o', "$dir";
system $mutt, qw( -R -f ), "$dir"
system $mutt, qw( -R -f ), "$dir";

exit;
}

exit 1;
@@ -4,7 +4,7 @@ if [ ! -d ~/.local/share/applications ]; then
exit
fi

for x in bible email fogbugz; do
for x in bible mid fogbugz; do
xdg-mime install ./xdg/frew-$x.desktop
xdg-mime default frew-$x.desktop x-scheme-handler/$x
cp ./xdg/frew-$x.desktop ~/.local/share/applications
@@ -5,4 +5,4 @@ Terminal=true
Type=Application
Categories=Utility;
StartupNotify=false
MimeType=x-scheme-handler/email;
MimeType=x-scheme-handler/mid;

0 comments on commit 0d08632

Please sign in to comment.