]> gitweb.fluxo.info Git - rhatto/dotfiles/mail.git/commitdiff
Feat: initial printing support
authorSilvio Rhatto <rhatto@riseup.net>
Tue, 2 May 2023 16:47:18 +0000 (13:47 -0300)
committerSilvio Rhatto <rhatto@riseup.net>
Tue, 2 May 2023 16:47:18 +0000 (13:47 -0300)
config.dot/firejail/mutt.profile.link
muttrc.dot.link

index a8978b60ea1f5b528cf11011bcfea2f70c327c8f..30aebae4187422de77e7b06ba84f62a31167c881 100644 (file)
@@ -36,6 +36,7 @@ noblacklist ~/apps/utils-mail
 noblacklist /usr/bin/fetchmail
 noblacklist /usr/bin/getmail
 noblacklist /usr/bin/getmails
+noblacklist /usr/bin/muttprint
 noblacklist /usr/bin/perl
 noblacklist /usr/bin/cpan*
 noblacklist /usr/share/perl*
index 9af1163d3ff74e5dfd5e905a799543e235b81b27..2a976caf55eb58f8c2ebecd141ac079c730b2c07 100644 (file)
@@ -37,10 +37,41 @@ set charset = "utf-8"
 # ----------------------
 # OS Specifiques options
 # ----------------------
-set print = ask-no
 set ispell="aspell -e -c --lang=pt_BR"
 set spoolfile = "~/mail/INBOX"
 
+# --------
+# Printing
+# --------
+
+# Disable printing entirely
+#bind index p noop
+#bind pager p noop
+#bind pager P noop
+
+# Always ask for confirmation
+set print = ask-no
+
+# Muttprint
+# See https://unix.stackexchange.com/questions/20456/pretty-print-mails-from-mutt
+#     https://muttprint.sourceforge.net/
+#
+# Display the PDF after printing it
+#set print_command='set -e; mkdir -p "$HOME"/.cache/mutt; f=`mktemp -p "$HOME"/.cache/mutt`; \
+#        muttprint -P A4 -p TO_FILE:"$f"; zathura "$f"; rm "$f"'
+#
+# Simply produce the PDF
+# Needs additional tuning on the mutt firejail profile in order to work
+#set print_command='set -e; mkdir -p "$HOME"/.cache/mutt; f=`mktemp -p "$HOME"/.cache/mutt muttprint.XXXX.ps`; \
+#        muttprint -P A4 -p TO_FILE:"$f"; ps2pdf "$f"; echo Saved output into `basename "$f" .ps`.pdf'
+
+# Simply output the message to a file
+set print_command='set -e; mkdir -p "$HOME"/.cache/mutt; f=`mktemp -p "$HOME"/.cache/mutt muttprint.XXXX.txt`; \
+        cat - > "$f"; echo Saved output into "$f" \
+        echo You convert it to a PDF using the following command: ; \
+        echo "" ; \
+        echo "cat $f | muttprint -P A4 -p TO_FILE:$f.ps ; ps2pdf $f.ps"'
+
 # ----------
 # Menu index
 # ----------
@@ -323,13 +354,6 @@ macro pager X "<enter-command>unset wait_key\n<pipe-entry>bogofilter -MNs\n<ente
 macro index H "<enter-command>unset wait_key\n<pipe-entry>bogofilter -n\n" "Learn as ham and save"
 macro pager H "<enter-command>unset wait_key\n<pipe-entry>bogofilter -n\n" "Learn as ham and save"
 
-# ----------------
-# Disable printing
-# ----------------
-bind index p noop
-bind pager p noop
-bind pager P noop
-
 # ----------------------------------------------------------------
 # Schleuder config
 #