rewrite underway
This commit is contained in:
BIN
bin/email.gif
Normal file
BIN
bin/email.gif
Normal file
Binary file not shown.
After Width: | Height: | Size: 7.4 KiB |
5
bin/getmuttpass
Executable file
5
bin/getmuttpass
Executable file
@ -0,0 +1,5 @@
|
||||
#!/bin/bash
|
||||
GPG="gpg"; command -v gpg >/dev/null || GPG="gpg2"
|
||||
pass=$(printf '%q' "$("$GPG" --decrypt --quiet ~/.local/share/muttwizard/$1.gpg)")
|
||||
echo "set smtp_pass=\"$pass\""
|
||||
echo "set imap_pass=\"$pass\""
|
11
bin/imappwd.py
Executable file
11
bin/imappwd.py
Executable file
@ -0,0 +1,11 @@
|
||||
import os.path
|
||||
import subprocess
|
||||
home = os.path.expanduser("~")
|
||||
def mailpasswd(acct):
|
||||
acct = os.path.basename(acct)
|
||||
path = "%s/.local/share/muttwizard/%s.gpg" % (home,acct)
|
||||
args = ["gpg2", "--use-agent", "--quiet", "--batch", "-d", path]
|
||||
try:
|
||||
return subprocess.check_output(args).strip().decode('UTF-8')
|
||||
except subprocess.CalledProcessError:
|
||||
return ""
|
7
bin/mailcap
Normal file
7
bin/mailcap
Normal file
@ -0,0 +1,7 @@
|
||||
text/plain; vim %s ;
|
||||
text/html; ~/.config/mutt/bin/openfile %s ;
|
||||
text/html; w3m -I %{charset} -T text/html; copiousoutput;
|
||||
image/*; ~/.config/mutt/bin/muttimage %s ; copiousoutput
|
||||
video/*; setsid mpv --quiet %s &; copiousoutput
|
||||
application/pdf; ~/.config/mutt/bin/openfile %s ;
|
||||
application/pgp-encrypted; gpg -d '%s'; copiousoutput;
|
43
bin/mailsync
Executable file
43
bin/mailsync
Executable file
@ -0,0 +1,43 @@
|
||||
#!/usr/bin/env sh
|
||||
# This script will run offlineimap and check
|
||||
# for new email if there is an internet connection.
|
||||
#
|
||||
# If it detects new mail, it uses mpv to play a
|
||||
# notification sound: notify.opus
|
||||
#
|
||||
# I have this run as a cronjob every 5 minutes.
|
||||
|
||||
export DISPLAY=:0.0
|
||||
|
||||
# Checks for internet connection and set notification script.
|
||||
ping -q -c 1 1.1.1.1 > /dev/null || exit
|
||||
# Settings are different for MacOS (Darwin) systems.
|
||||
if [ "$(uname)" = "Darwin" ]
|
||||
then
|
||||
notify() { osascript -e "display notification \"$2 in $1\" with title \"You've got Mail\" subtitle \"Account: $account\"" && sleep 2 ;}
|
||||
else
|
||||
notify() { mpv --really-quiet ~/.config/mutt/bin/notify.opus & pgrep -x dunst && notify-send -i ~/.config/mutt/bin/email.gif "$2 new mail(s) in \`$1\` account." ;}
|
||||
fi
|
||||
|
||||
echo " 🔃" > /tmp/imapsyncicon
|
||||
pkill -RTMIN+12 i3blocks
|
||||
|
||||
# Run offlineimap. You can feed this script different settings.
|
||||
offlineimap -o "$@"
|
||||
rm -f /tmp/imapsyncicon
|
||||
pkill -RTMIN+12 i3blocks
|
||||
|
||||
# Check all accounts/mailboxes for new mail. Notify if there is new content.
|
||||
for account in $(ls ~/.local/share/mail)
|
||||
do
|
||||
#List unread messages newer than last mailsync and count them
|
||||
newcount=$(find ~/.mail/"$account"/INBOX/new/ -type f -newer ~/.config/mutt/bin/.mailsynclastrun 2> /dev/null | wc -l)
|
||||
if [ "$newcount" -gt "0" ]
|
||||
then
|
||||
notify "$account" "$newcount" &
|
||||
fi
|
||||
done
|
||||
notmuch new
|
||||
|
||||
#Create a touch file that indicates the time of the last run of mailsync
|
||||
touch ~/.config/mutt/bin/.mailsynclastrun
|
8
bin/muttimage
Executable file
8
bin/muttimage
Executable file
@ -0,0 +1,8 @@
|
||||
#! /bin/sh
|
||||
|
||||
#### Determine size of Terminal
|
||||
height=`stty size | awk 'BEGIN {FS = " "} {print $1;}'`
|
||||
width=`stty size | awk 'BEGIN {FS = " "} {print $2;}'`
|
||||
|
||||
### Display Image / offset with mutt bar
|
||||
echo -e "2;3;\n0;1;210;20;$((width*7-250));$((height*14-100));0;0;0;0;$1\n4;\n3;" | /usr/lib/w3m/w3mimgdisplay &
|
BIN
bin/notify.opus
Normal file
BIN
bin/notify.opus
Normal file
Binary file not shown.
9
bin/openfile
Executable file
9
bin/openfile
Executable file
@ -0,0 +1,9 @@
|
||||
#!/bin/sh
|
||||
# Helps open a file with xdg-open from mutt in a external program without weird side effects.
|
||||
|
||||
base=$(basename "$1")
|
||||
ext="${base##*.}"
|
||||
file=$(mktemp -u --suffix=".$ext")
|
||||
rm -f "$file"
|
||||
cp "$1" "$file"
|
||||
setsid xdg-open "$file" >/dev/null 2>&1 &
|
Reference in New Issue
Block a user