From 1b55d5d0506f5406dd473e85d3cf47e638af40f2 Mon Sep 17 00:00:00 2001 From: Maximilian Friedersdorff Date: Mon, 11 Feb 2019 12:29:09 +0000 Subject: [PATCH] feat: Use mutt for mailto links --- X/.Xresources | 2 +- mail/.local/bin/muttmailto | 23 +++++++++++++++++++ .../share/applications/mutt-mailto.desktop | 9 ++++++++ 3 files changed, 33 insertions(+), 1 deletion(-) create mode 100755 mail/.local/bin/muttmailto create mode 100644 mail/.local/share/applications/mutt-mailto.desktop diff --git a/X/.Xresources b/X/.Xresources index baab6f2..dd3ea58 100644 --- a/X/.Xresources +++ b/X/.Xresources @@ -65,5 +65,5 @@ XTerm*allowSendEvents: true URxvt.perl-ext-common: matcher -URxvt.url-launcher: qutebrowser +URxvt.url-launcher: xdg-open URxvt.matcher.button: 1 diff --git a/mail/.local/bin/muttmailto b/mail/.local/bin/muttmailto new file mode 100755 index 0000000..3a142b8 --- /dev/null +++ b/mail/.local/bin/muttmailto @@ -0,0 +1,23 @@ +#!/bin/bash + +# NoSuck.org +# Mutt Mailto Handler for XDG Environment +# From https://github.com/NoSuck/MuttMailto + +if [[ "$1" == mailto:* ]] ; then + sStart="${1%%\?*}" + sEnd="&${1##*\?}" + # The whitelist. + sValidAttributes=( "Subject" ) + for sAttribute in "${sValidAttributes[@]}" ; do + sHit="$( echo "$sEnd" | sed "s/^.*&$sAttribute=\([^&]*\).*/$sAttribute=\1/" )" + if [[ "$sEndNew" ]] ; then + sEndNew="$sEndNew&$sHit" + else + sEndNew="?$sHit" + fi + done +fi +sNewMailto="$sStart$sEndNew" +# Modify as necessary. +i3-sensible-terminal -e /bin/sh -c "mutt -F ~/.mutt/mutt.uk.ac.aber.maf54_online ${sNewMailto:+ \"$sNewMailto\"}" & diff --git a/mail/.local/share/applications/mutt-mailto.desktop b/mail/.local/share/applications/mutt-mailto.desktop new file mode 100644 index 0000000..b4e8304 --- /dev/null +++ b/mail/.local/share/applications/mutt-mailto.desktop @@ -0,0 +1,9 @@ +[Desktop Entry] +Type=Application +Name=Mutt Mailto Handler +GenericName=MUA +Comment=Supposedly sucks less. +Exec=/home/max/.local/bin/muttmailto +Terminal=true +MimeType=x-scheme-handler/mailto +NoDisplay=true -- 2.46.2