feat: neomutt open file through mailcap + xdg-open
This commit is contained in:
parent
5243ab4b38
commit
ac9ed58abe
9
.config/mutt/mailcap
Normal file
9
.config/mutt/mailcap
Normal file
@ -0,0 +1,9 @@
|
||||
text/plain; $EDITOR %s ;
|
||||
text/html; lynx -assume_charset=%{charset} -display_charset=utf-8 -dump %s; nametemplate=%s.html; copiousoutput;
|
||||
text/html; mutt-openfile %s ; nametemplate=%s.html
|
||||
image/*; mutt-openfile %s ;
|
||||
video/*; setsid mpv --quiet %s &; copiousoutput
|
||||
audio/*; mpv %s ;
|
||||
application/pdf; mutt-openfile %s ;
|
||||
application/pgp-encrypted; gpg -d '%s'; copiousoutput;
|
||||
application/pgp-keys; gpg --import '%s'; copiousoutput;
|
@ -5,6 +5,7 @@
|
||||
|
||||
# This file contains part of mutt-wizard's default settings.
|
||||
# mutt-wizard will have this file sourced from your muttrc.
|
||||
set mailcap_path = /home/swytch/.config/mutt/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)"
|
||||
|
@ -39,6 +39,7 @@ libnotify
|
||||
libtool
|
||||
linux
|
||||
linux-firmware
|
||||
lynx
|
||||
m4
|
||||
make
|
||||
man-db
|
||||
|
19
.local/bin/mutt-openfile
Executable file
19
.local/bin/mutt-openfile
Executable file
@ -0,0 +1,19 @@
|
||||
#!/usr/bin/env sh
|
||||
|
||||
######################################################################
|
||||
# @author : swytch (adapted from Luke Smith - lukesmith.xyz)
|
||||
# @file : mutt-openfile
|
||||
# @license : GPLv3
|
||||
# @created : Tuesday Feb 16, 2021 11:50:16 CET
|
||||
#
|
||||
# @description : open a file with xdg-open from mutt
|
||||
######################################################################
|
||||
|
||||
|
||||
tempdir="${XDG_CACHE_HOME:-$HOME/.cache}/mutt/files"
|
||||
file="$tempdir/$(basename "$1")"
|
||||
opener="setsid -f xdg-open"
|
||||
mkdir -p "$tempdir"
|
||||
cp -f "$1" "$file"
|
||||
$opener "$file" >/dev/null 2>&1
|
||||
find "${tempdir:?}" -mtime +1 -type f -delete
|
Reference in New Issue
Block a user