I wanted to start mutt in terminal when I click on some mailto: tag in a webpage. Is that possible? Currently Firefox starts, which I really don't favor; it's slow loading and unnecessary.

4 Answers 4


First you need to ensure that there's a .desktop file which is required by the XDG specification. For GUI programs the chance is good that there already is a suitable .desktop file, for terminal applications usually you have to create your own one. Check out the directory /usr/share/applications for existing files. Maybe there is already a mutt.desktop file. If there isn't, create one.

Then edit the file ~/.local/share/applications/mimeapps.list and add the following line

[Default Applications]

This registers mutt with the mailto handler. You can confirm a successful registration with

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

which should output mutt.desktop. Now you can click on “mailto” in chromium and a terminal should pop up with a mutt instance. No need to even restart the desktop session or the browser.


You need to write a script that's specifies the terminal that you want mutt to open in. Then, in Firefox, you can associate this script with mailto links. For example, if you are using terminator, you can create the following script.

#!/usr/bin/env bash
terminator -x "mutt '$@'"

In my case, I have a persistent drop-down terminator, so I want it in a new tab. I also need a 256 colour palette, so I use

#!/usr/bin/env bash
terminator --new-tab -x "TERM=xterm-256color; mutt '$@'"

FWIW this is my full script, which also unhides terminator (if hidden), using the shortcut Ctrl+Space, and brings it to the front.

#!/usr/bin/env bash

terminator --new-tab -x "TERM=xterm-256color; mutt '$@'"

# If necessary, unhide and focus terminator window.
windowlist=$(xprop -root | sed -rn 's/_NET_CLIENT_LIST_STACKING\(WINDOW\): window id # (.*)/\1/p' | tr -d ',')
for i in $windowlist; do
  [[ $(xprop -id $i | grep WM_CLASS\(STRING\)) == 'WM_CLASS(STRING) = "terminator", "Terminator"' ]] && terminator_visible=true && term_id=$i

if [[ $terminator_visible == false ]]; then # it's hidden
  xdotool key --clearmodifiers ctrl+space
elif [[ $(xprop -id $(xdotool getactivewindow) | grep WM_CLASS\(STRING\)) != 'WM_CLASS(STRING) = "terminator", "Terminator"' ]]; then # it's visible, but not active
  xdotool windowactivate $term_id 2> /dev/null # Gives error; not sure why. XGetWindowProperty[_NET_WM_DESKTOP] failed (code=1)

Which desktop environment are you running? You need to check it's MIME type handler's settings on how to set a specific handler for these kind of things.

  • OpenBox , i just don't know how to get the mimetype , it's not a file , i can't just run 'mimetype /path/to/file' to identify it
    – daisy
    Aug 16, 2011 at 12:55

You can use xdg-mime to register a default application. In that case you run on a terminal:

xdg-mime default mutt.desktop 'x-scheme-handler/mailto'

And you can check if it worked by running:

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

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .