aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSilvio Rhatto <rhatto@riseup.net>2023-05-02 13:47:18 -0300
committerSilvio Rhatto <rhatto@riseup.net>2023-05-02 13:47:18 -0300
commit7a7b4a309629ac2f401816ab044ee3ece34bf130 (patch)
tree1f72725db3e714ab049ef6a7eb114ad37f56d4e6
parente8e4b4413b78d3eb0b34bb25c70d2d2f696725e4 (diff)
downloadmail-7a7b4a309629ac2f401816ab044ee3ece34bf130.tar.gz
mail-7a7b4a309629ac2f401816ab044ee3ece34bf130.tar.bz2
Feat: initial printing support
-rw-r--r--config.dot/firejail/mutt.profile.link1
-rw-r--r--muttrc.dot.link40
2 files changed, 33 insertions, 8 deletions
diff --git a/config.dot/firejail/mutt.profile.link b/config.dot/firejail/mutt.profile.link
index a8978b6..30aebae 100644
--- a/config.dot/firejail/mutt.profile.link
+++ b/config.dot/firejail/mutt.profile.link
@@ -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*
diff --git a/muttrc.dot.link b/muttrc.dot.link
index 9af1163..2a976ca 100644
--- a/muttrc.dot.link
+++ b/muttrc.dot.link
@@ -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
#