RFC: desktop entry for xdg-email

Antoine Beaupré anarcat at orangeseeds.org
Fri Nov 1 17:55:19 PDT 2019


On my system, if I click on mailto: links in my web browser (yes, those
still exist), Thunderbird starts up. Oh the horror!

Wouldn't it be nice if notmuch-emacs-mua would start instead?

Worry not my notmuch friends! I have a solution for you!11!!!

First, you need to drop something like this in /usr/share/applications/notmuch-emacs-mua.desktop

[Desktop Entry]
Categories=Office;Network;Email;
Comment=Notmuch mail
Exec=notmuch-emacs-mua --client --create-frame --auto-daemon %u
Name=notmuch-emacs-mua
MimeType=x-scheme-handler/mailto;
Type=Application

Liberally inspired by mutt.desktop and probably horribly wrong in many
ways:

 * missing an icon (do we ship one of those?)
 * doesn't handle message/rfc822something (a job for
   notmuch-slurp-something?)
 * might hurt your cat (poor tokenized thing)
 * do you like .INI files? me neither!
 * what the heck is that thing anyways and how do I include that in a
   Debian package?

I know right? It's great. Once you have figured out all that good stuff,
the next step is to hook that up in your web browser. You will be happy
to know there is a "standard" (as in "it starts with X so it *must* be
cool because mutants are cool") that defines how that work, from the
"Cross Desktop Group"

https://specifications.freedesktop.org/mime-apps-spec/latest/index.html

(The "Cross" in this context probably refers to:

     11. Hence: A mixing of breeds or stock, especially in cattle
         breeding; or the product of such intermixture; a hybrid
         of any kind.

... and obviously not:

     1. A gibbet, consisting of two pieces of timber placed
        transversely upon one another, in various forms, as a T,
        or +, with the horizontal piece below the upper end of the
        upright, or as an X. It was anciently used in the
        execution of criminals.

... and probably not:

     3. Affiction regarded as a test of patience or virtue; trial;
        disappointment; opposition; misfortune.

... anyways, I disgress.)

Apparently, to figure out the current setting, you (obviously) will need
to run something like this:

    xdg-mime query default x-scheme-handler/mailto

It will probably not show you notmuch. Sad face. At that point, you will
probably launch whatever control panel, dashboard, settings app,
resource editor, or whatever that thing is called these days, and set
your prefered app. If you are an old obstinate grumpy graybeard like me
that refuse any sort of progress and is stuck in a mostly black and
white "GUI" full of text that no one understands, you know everyone
fundamentally hates each other and the world is pain, so *obviously* you
will need to edit another text file to make the above behave.

So head over your favorite text editor (let's not discuss that further
shall we) to .config/mimeapps.list and add a line like this:

    x-scheme-handler/mailto=notmuch-emacs-mua.desktop

You'll note the file probably already exists if you use any modern web
browser because those folks *love* to fight with each other (told you,
hate, hate everywhere) for supremacy over that file. Just add that line
somewhere meaningful until `xdg-email` and the above `xdg-mime` query
works correctly.

Then you can thank me the next (last?) time you ever encounter a mailto:
link. It's going to be a funny surprise!

Oh, and the next time you find a contact form to send email, just fax
bomb it or something.

Have a good weekend.

A.

PS: I tried to make this one entertaining, sorry if it's a bit long or
offensive to some, let me know if I went too far. :)

-- 
Perl is "some assembly required". Python is "batteries included". PHP
is "kitchen sink, but it’s from Canada and both faucets are labeled C".
                         - Alex Munroe, PHP: a fractal of bad design


More information about the notmuch mailing list