As part of my ongoing project to make Mutt more useable for me, I looked for a way to add attachments to Mutt with a GUI dialog. While usually doing things on the keyboard is faster (and this is the whole premise of using Mutt), for me, this is not true for selecting files. I find the “Recent files” section in the GNOME file dialogs especially helpful and can more quickly locate files this way than any other.
How to achieve this? First, you need the
zenity package installed which lets you use GUI dialogs from the command line.
Then you have to add the following to your
This calls first the
attach-file.sh script in your Mutt’s config directory and then executes the commands in
What does the script look like?
1 2 3 4 5 6 7 8 9
This script selects a file with the Zenity dialog, it copies that file to the
tmp directory and removes any spaces from the file name in that process (for whatever reason this is needed to work). Finally, it inserts the relevant Mutt commands to attach this file into
/tmp/muttpick (which gets executed by Mutt after the scripts end per the macro above).