summaryrefslogtreecommitdiff
path: root/etc
diff options
context:
space:
mode:
Diffstat (limited to 'etc')
-rw-r--r--etc/email.gifbin0 -> 7545 bytes
-rwxr-xr-xetc/htmlopen.sh10
-rw-r--r--etc/mailcap16
-rwxr-xr-xetc/mailsync.sh44
-rw-r--r--etc/muttcol115
-rw-r--r--etc/notify.opusbin0 -> 28900 bytes
-rwxr-xr-xetc/view_attachment.sh127
7 files changed, 250 insertions, 62 deletions
diff --git a/etc/email.gif b/etc/email.gif
new file mode 100644
index 0000000..1ed63cf
--- /dev/null
+++ b/etc/email.gif
Binary files differ
diff --git a/etc/htmlopen.sh b/etc/htmlopen.sh
new file mode 100755
index 0000000..a0d6c35
--- /dev/null
+++ b/etc/htmlopen.sh
@@ -0,0 +1,10 @@
+#!/bin/sh
+
+# Helps open an HTML file from mutt in a GUI browser without weird side effects.
+
+file=$(mktemp -u --suffix=.html)
+
+echo $file
+cp "$1" "$file"
+
+setsid firefox "$file" &
diff --git a/etc/mailcap b/etc/mailcap
index 45b54f3..519c8a5 100644
--- a/etc/mailcap
+++ b/etc/mailcap
@@ -1,13 +1,7 @@
-#text/html; qutebrowser %s &; test=test -n "$DISPLAY"; needsterminal;
-
+text/plain; vim %s ;
+text/html; ~/.config/mutt/etc/htmlopen.sh %s ;
text/html; w3m -I %{charset} -T text/html; copiousoutput;
-#text/html; mv %s %s.html && qutebrowser %s.html > /dev/null; needsterminal;
-#
-application/pdf; mv %s %s.pdf && i3 exec mupdf %s.pdf > /dev/null; needsterminal;
-
image/*; ~/.config/mutt/etc/muttimage.sh %s ; copiousoutput
-
-#application/pdf; pdftotext '%s' -; copiousoutput; description=PDF Document;
-#nametemplate=%s.pdf
-#
-text/plain; vim %s ;
+video/*; setsid mpv --quiet %s &; copiousoutput
+application/pdf; cp '%s' /tmp/doc.pdf && setsid zathura /tmp/doc.pdf &; copiousoutput;
+application/pgp-encrypted; gpg -d '%s'; copiousoutput;
diff --git a/etc/mailsync.sh b/etc/mailsync.sh
new file mode 100755
index 0000000..5f8d8a7
--- /dev/null
+++ b/etc/mailsync.sh
@@ -0,0 +1,44 @@
+#!/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.
+# Settings are different for MacOS (Darwin) systems.
+if [ "$(uname)" = "Darwin" ]
+then
+ ping -q -t 1 -c 1 `ip r | grep -m 1 default | cut -d ' ' -f 3` >/dev/null || exit
+ notify() { osascript -e "display notification \"$2 in $1\" with title \"You've got Mail\" subtitle \"Account: $account\"" && sleep 2 ;}
+else
+ ping -q -w 1 -c 1 `ip r | grep -m 1 default | cut -d ' ' -f 3` >/dev/null || exit
+ notify() { mpv --really-quiet ~/.config/mutt/etc/notify.opus & pgrep -x dunst && notify-send -i ~/.config/mutt/etc/email.gif "$2 new mail(s) in \`$1\` account." ;}
+fi
+
+echo 🔃 > ~/.config/mutt/.dl
+pkill -RTMIN+12 i3blocks
+
+# Run offlineimap. You can feed this script different settings.
+offlineimap -o "$@"
+rm -f ~/.config/mutt/.dl
+pkill -RTMIN+12 i3blocks
+
+# Check all accounts/mailboxes for new mail. Notify if there is new content.
+for account in $(ls ~/.mail)
+do
+ #List unread messages newer than last mailsync and count them
+ newcount=$(find ~/.mail/"$account"/INBOX/new/ -type f -newer ~/.config/mutt/etc/mailsynclastrun 2> /dev/null | wc -l)
+ if [ "$newcount" -gt "0" ]
+ then
+ setsid notify "$account" "$newcount" &
+ fi
+done
+notmuch new
+
+#Create a touch file that indicates the time of the last run of mailsync
+touch ~/.config/mutt/etc/mailsynclastrun
diff --git a/etc/muttcol b/etc/muttcol
index 78704fd..073a8bd 100644
--- a/etc/muttcol
+++ b/etc/muttcol
@@ -1,58 +1,71 @@
# vim: filetype=neomuttrc
-mono bold bold
-mono underline underline
-mono indicator reverse
+
+# Default index colors:
color index yellow default '.*'
color index_author red default '.*'
color index_number blue default
-color index_subject cyan default '.s'
-color index_size green default
+color index_subject cyan default '.*'
+
+# For new mail:
+color index brightyellow black "~N"
+color index_author brightred black "~N"
+color index_subject brightcyan black "~N"
+
+# Header colors:
+color header blue default ".*"
+color header brightmagenta default "^(From)"
+color header brightcyan default "^(Subject)"
+color header brightwhite default "^(CC|BCC)"
+
+mono bold bold
+mono underline underline
+mono indicator reverse
+mono error bold
color normal default default
-color body brightred default [\-\.+_a-zA-Z0-9]+@[\-\.a-zA-Z0-9]+
-color body brightblue default (https?|ftp)://[\-\.,/%~_:?&=\#a-zA-Z0-9]+
-color indicator cyan black
-color sidebar_highlight black color8
-color sidebar_divider color8 black
+color indicator brightblack white
+color sidebar_highlight red default
+color sidebar_divider brightblack black
color sidebar_flagged red black
color sidebar_new green black
-color normal brightyellow default
-color error red default
-color tilde black default
-color message cyan default
-color markers red white
-color attachment white default
-color search brightmagenta default
-color status brightyellow black
-color indicator brightblack yellow
-mono bold bold
-mono underline underline
-mono indicator reverse
-mono error bold
-color hdrdefault brightgreen default
-color header brightyellow default "^(From)"
-color header blue default "^(Subject)"
-color quoted green default
-color quoted1 blue default
-color quoted2 cyan default
-color quoted3 yellow default
-color quoted4 red default
-color quoted5 brightred default
-color signature brightgreen default
-color bold black default
-color underline black default
-color normal default default
-color body brightcyan default "[;:][-o][)/(|]" # emoticons
-color body brightcyan default "[;:][)(|]" # emoticons
-color body brightcyan default "[*]?((N)?ACK|CU|LOL|SCNR|BRB|BTW|CWYL|\
- |FWIW|vbg|GD&R|HTH|HTHBE|IMHO|IMNSHO|\
- |IRL|RTFM|ROTFL|ROFL|YMMV)[*]?"
-color body brightcyan default "[ ][*][^*]*[*][ ]?" # more emoticon?
-color body brightcyan default "[ ]?[*][^*]*[*][ ]" # more emoticon?
-color body red default "(BAD signature)"
-color body cyan default "(Good signature)"
-color body brightblack default "^gpg: Good signature .*"
-color body brightyellow default "^gpg: "
-color body brightyellow red "^gpg: BAD signature from.*"
-mono body bold "^gpg: Good signature"
-mono body bold "^gpg: BAD signature from.*"
-color body red default "([a-z][a-z0-9+-]*://(((([a-z0-9_.!~*'();:&=+$,-]|%[0-9a-f][0-9a-f])*@)?((([a-z0-9]([a-z0-9-]*[a-z0-9])?)\\.)*([a-z]([a-z0-9-]*[a-z0-9])?)\\.?|[0-9]+\\.[0-9]+\\.[0-9]+\\.[0-9]+)(:[0-9]+)?)|([a-z0-9_.!~*'()$,;:@&=+-]|%[0-9a-f][0-9a-f])+)(/([a-z0-9_.!~*'():@&=+$,-]|%[0-9a-f][0-9a-f])*(;([a-z0-9_.!~*'():@&=+$,-]|%[0-9a-f][0-9a-f])*)*(/([a-z0-9_.!~*'():@&=+$,-]|%[0-9a-f][0-9a-f])*(;([a-z0-9_.!~*'():@&=+$,-]|%[0-9a-f][0-9a-f])*)*)*)?(\\?([a-z0-9_.!~*'();/?:@&=+$,-]|%[0-9a-f][0-9a-f])*)?(#([a-z0-9_.!~*'();/?:@&=+$,-]|%[0-9a-f][0-9a-f])*)?|(www|ftp)\\.(([a-z0-9]([a-z0-9-]*[a-z0-9])?)\\.)*([a-z]([a-z0-9-]*[a-z0-9])?)\\.?(:[0-9]+)?(/([-a-z0-9_.!~*'():@&=+$,]|%[0-9a-f][0-9a-f])*(;([-a-z0-9_.!~*'():@&=+$,]|%[0-9a-f][0-9a-f])*)*(/([-a-z0-9_.!~*'():@&=+$,]|%[0-9a-f][0-9a-f])*(;([-a-z0-9_.!~*'():@&=+$,]|%[0-9a-f][0-9a-f])*)*)*)?(\\?([-a-z0-9_.!~*'();/?:@&=+$,]|%[0-9a-f][0-9a-f])*)?(#([-a-z0-9_.!~*'();/?:@&=+$,]|%[0-9a-f][0-9a-f])*)?)[^].,:;!)? \t\r\n<>\"]"
+color normal brightyellow default
+color error red default
+color tilde black default
+color message cyan default
+color markers red white
+color attachment white default
+color search brightmagenta default
+color status brightyellow black
+color hdrdefault brightgreen default
+color quoted green default
+color quoted1 blue default
+color quoted2 cyan default
+color quoted3 yellow default
+color quoted4 red default
+color quoted5 brightred default
+color signature brightgreen default
+color bold black default
+color underline black default
+color normal default default
+
+color body brightred default "[\-\.+_a-zA-Z0-9]+@[\-\.a-zA-Z0-9]+" # Email addresses
+color body brightblue default "(https?|ftp)://[\-\.,/%~_:?&=\#a-zA-Z0-9]+" # URL
+color body green default "\`[^\`]*\`" # Green text between ` and `
+color body brightblue default "^# \.*" # Headings as bold blue
+color body brightcyan default "^## \.*" # Subheadings as bold cyan
+color body brightgreen default "^### \.*" # Subsubheadings as bold green
+color body yellow default "^(\t| )*(-|\\*) \.*" # List items as yellow
+color body brightcyan default "[;:][-o][)/(|]" # emoticons
+color body brightcyan default "[;:][)(|]" # emoticons
+color body brightcyan default "[*]?((N)?ACK|CU|LOL|SCNR|BRB|BTW|CWYL|\
+ |FWIW|vbg|GD&R|HTH|HTHBE|IMHO|IMNSHO|\
+ |IRL|RTFM|ROTFL|ROFL|YMMV)[*]?"
+color body brightcyan default "[ ][*][^*]*[*][ ]?" # more emoticon?
+color body brightcyan default "[ ]?[*][^*]*[*][ ]" # more emoticon?
+color body red default "(BAD signature)"
+color body cyan default "(Good signature)"
+color body brightblack default "^gpg: Good signature .*"
+color body brightyellow default "^gpg: "
+color body brightyellow red "^gpg: BAD signature from.*"
+mono body bold "^gpg: Good signature"
+mono body bold "^gpg: BAD signature from.*"
+color body red default "([a-z][a-z0-9+-]*://(((([a-z0-9_.!~*'();:&=+$,-]|%[0-9a-f][0-9a-f])*@)?((([a-z0-9]([a-z0-9-]*[a-z0-9])?)\\.)*([a-z]([a-z0-9-]*[a-z0-9])?)\\.?|[0-9]+\\.[0-9]+\\.[0-9]+\\.[0-9]+)(:[0-9]+)?)|([a-z0-9_.!~*'()$,;:@&=+-]|%[0-9a-f][0-9a-f])+)(/([a-z0-9_.!~*'():@&=+$,-]|%[0-9a-f][0-9a-f])*(;([a-z0-9_.!~*'():@&=+$,-]|%[0-9a-f][0-9a-f])*)*(/([a-z0-9_.!~*'():@&=+$,-]|%[0-9a-f][0-9a-f])*(;([a-z0-9_.!~*'():@&=+$,-]|%[0-9a-f][0-9a-f])*)*)*)?(\\?([a-z0-9_.!~*'();/?:@&=+$,-]|%[0-9a-f][0-9a-f])*)?(#([a-z0-9_.!~*'();/?:@&=+$,-]|%[0-9a-f][0-9a-f])*)?|(www|ftp)\\.(([a-z0-9]([a-z0-9-]*[a-z0-9])?)\\.)*([a-z]([a-z0-9-]*[a-z0-9])?)\\.?(:[0-9]+)?(/([-a-z0-9_.!~*'():@&=+$,]|%[0-9a-f][0-9a-f])*(;([-a-z0-9_.!~*'():@&=+$,]|%[0-9a-f][0-9a-f])*)*(/([-a-z0-9_.!~*'():@&=+$,]|%[0-9a-f][0-9a-f])*(;([-a-z0-9_.!~*'():@&=+$,]|%[0-9a-f][0-9a-f])*)*)*)?(\\?([-a-z0-9_.!~*'();/?:@&=+$,]|%[0-9a-f][0-9a-f])*)?(#([-a-z0-9_.!~*'();/?:@&=+$,]|%[0-9a-f][0-9a-f])*)?)[^].,:;!)? \t\r\n<>\"]"
diff --git a/etc/notify.opus b/etc/notify.opus
new file mode 100644
index 0000000..a76ce32
--- /dev/null
+++ b/etc/notify.opus
Binary files differ
diff --git a/etc/view_attachment.sh b/etc/view_attachment.sh
new file mode 100755
index 0000000..df8b9a1
--- /dev/null
+++ b/etc/view_attachment.sh
@@ -0,0 +1,127 @@
+#!/bin/bash
+#
+# Author: Eric Gebhart
+#
+# Purpose: To be called by mutt as indicated by .mailcap to handle mail attachments.
+#
+# Function: Copy the given file to a temporary directory so mutt
+# Won't delete it before it is read by the application.
+#
+# Along the way, discern the file type or use the type
+# That is given.
+#
+# Finally use 'open' or 'open -a' if the third argument is
+# given.
+#
+#
+# Arguments:
+#
+# $1 is the file
+# $2 is the type - for those times when file magic isn't enough.
+# I frequently get html mail that has no extension
+# and file can't figure out what it is.
+#
+# Set to '-' if you don't want the type to be discerned.
+# Many applications can sniff out the type on their own.
+# And they do a better job of it too.
+#
+# Open Office and MS Office for example.
+#
+# $3 is open with. as in open -a 'open with this .app' foo.xls
+#
+# Examples: These are typical .mailcap entries which use this program.
+#
+# Image/JPEG; /Users/vdanen/.mutt/view_attachment %s
+# Image/PNG; /Users/vdanen/.mutt/view_attachment %s
+# Image/GIF; /Users/vdanen/.mutt/view_attachment %s
+#
+# Application/PDF; /Users/vdanen/.mutt/view_attachment %s
+#
+# #This HTML example passes the type because file doesn't always work and
+# #there aren't always extensions.
+#
+# text/html; /Users/vdanen/.mutt/view_attachment %s html
+#
+# # If your Start OpenOffice.org.app is spelled with a space like this one, <--
+# # then you'll need to precede the space with a \ . I found that too painful
+# # and renamed it with an _.
+#
+# Application/vnd.ms-excel; /Users/vdanen/.mutt/view_attachment %s "-" '/Applications/OpenOffice.org1.1.2/Start_OpenOffice.org.app'
+# Application/msword; /Users/vdanen/.mutt/view_attachment %s "-" '/Applications/OpenOffice.org1.1.2/Start_OpenOffice.org.app'
+#
+#
+# Debugging: If you have problems set debug to 'yes'. That will cause a debug file
+# be written to /tmp/mutt_attach/debug so you can see what is going on.
+#
+# See Also: The man pages for open, file, basename
+#
+
+# the tmp directory to use.
+tmpdir="$HOME/.tmp/mutt_attach"
+
+# the name of the debug file if debugging is turned on.
+debug_file=$tmpdir/debug
+
+# debug. yes or no.
+#debug="no"
+debug="yes"
+
+type=$2
+open_with=$3
+
+# make sure the tmpdir exists.
+mkdir -p $tmpdir
+
+# clean it out. Remove this if you want the directory
+# to accumulate attachment files.
+rm -f $tmpdir/*
+
+# Mutt puts everything in /tmp by default.
+# This gets the basic filename from the full pathname.
+filename=`basename $1`
+
+# get rid of the extenson and save the name for later.
+file=`echo $filename | cut -d"." -f1`
+
+if [ $debug = "yes" ]; then
+ echo "1:" $1 " 2:" $2 " 3:" $3 > $debug_file
+ echo "Filename:"$filename >> $debug_file
+ echo "File:"$file >> $debug_file
+ echo "===========================" >> $debug_file
+fi
+
+# if the type is empty then try to figure it out.
+if [ -z $type ]; then
+ file $1
+ type=`file -bi $1 | cut -d"/" -f2`
+fi
+
+# if the type is '-' then we don't want to mess with type.
+# Otherwise we are rebuilding the name. Either from the
+# type that was passed in or from the type we discerned.
+if [ $type = "-" ]; then
+ newfile=$filename
+else
+ newfile=$file.$type
+fi
+
+newfile=$tmpdir/$newfile
+
+# Copy the file to our new spot so mutt can't delete it
+# before the app has a chance to view it.
+cp $1 $newfile
+
+if [ $debug = "yes" ]; then
+ echo "File:" $file "TYPE:" $type >> $debug_file
+ echo "Newfile:" $newfile >> $debug_file
+ echo "Open With:" $open_with >> $debug_file
+fi
+
+# If there's no 'open with' then we can let preview do it's thing.
+# Otherwise we've been told what to use. So do an open -a.
+
+if [ -z $open_with ]; then
+ open $newfile
+else
+ open -a "$open_with" $newfile
+fi