Add mailcap

This commit is contained in:
flyingscorpio@clevo 2022-05-14 16:53:03 +02:00
parent 7051a6abef
commit 4840e2eb11
4 changed files with 38 additions and 5 deletions

View file

@ -0,0 +1,9 @@
text/plain; $EDITOR %s;
text/html; ~/.local/bin/openfile %s; nametemplate=%s.html
text/html; lynx -assume_charset=%{charset} -display_charset=utf-8 -dump -width=1024 %s; nametemplate=%s.html; copiousoutput;
image/*; ~/.local/bin/openfile %s;
video/*; setsid mpv --quiet %s &; copiousoutput
audio/*; mpv %s;
application/pdf; ~/.local/bin/openfile %s;
application/pgp-encrypted; gpg -d '%s'; copiousoutput;
application/pgp-keys; gpg --import '%s'; copiousoutput;

View file

@ -0,0 +1,9 @@
#!/bin/sh
# Helps open a file with xdg-open from mutt in a external program without weird side effects.
tempdir="$HOME/.cache/neomutt/files"
file="$tempdir/${1##*/}"
mkdir -p "$tempdir"
cp -f "$1" "$file"
setsid -f xdg-open "$file" >/dev/null 2>&1
find "${tempdir:?}" -mtime +1 -type f -delete

View file

@ -6,6 +6,8 @@
pacman:
name:
- neomutt
- lynx
- mpv
when: ansible_facts['distribution'] == 'Archlinux'
- name: Install packages (Debian)
@ -13,6 +15,8 @@
apt:
name:
- neomutt
- lynx
- mpv
when: ansible_facts['distribution'] == 'Debian'
- name: Get installed neomutt version
@ -54,3 +58,14 @@
file:
path: ~/.cache/neomutt
state: directory
- name: Copy mailcap file
copy:
src: mailcap
dest: ~/.config/neomutt/mailcap
- name: Copy openfile script
copy:
src: openfile
dest: ~/.local/bin/openfile
mode: 0755

View file

@ -1,5 +1,5 @@
#set mailcap_path = $HOME/.config/mutt/mailcap:/usr/local/share/mutt-wizard/mailcap:$mailcap_path
#set mime_type_query_command = "file --mime-type -b %s"
set mailcap_path = $HOME/.config/neomutt/mailcap:$mailcap_path
set mime_type_query_command = "file --mime-type -b %s"
set date_format="%y/%m/%d %I:%M%p"
set index_format="%2C %Z %?X?A& ? %D %-15.15F %s (%-4.4c)"
set sort = 'reverse-date'
@ -20,9 +20,9 @@ set include # include message in replies
set mail_check = 120 # how often to check for new mail (in seconds)
set imap_keepalive = 300 # intermittent polling to keep connection alive (in seconds)
unset imap_passive # open imap connection when checking for mail
#auto_view text/html # automatically show html (mailcap uses lynx)
#auto_view application/pgp-encrypted
#alternative_order text/plain text/enriched text/html
auto_view text/html # automatically show html (mailcap uses lynx)
auto_view application/pgp-encrypted
alternative_order text/plain text/enriched text/html
bind index,pager i noop
bind index,pager g noop