tweak mu4e syncing.

This commit is contained in:
Ivan Malison 2014-12-20 01:23:42 -08:00
parent b23fbd2ea1
commit 15e12f06b5
3 changed files with 22 additions and 11 deletions

View File

@ -1,21 +1,26 @@
MAILDIR="$HOME/Mail" MAILDIR="$HOME/Mail"
SYNC_STAMP="$HOME/.mail-sync" SYNC_STAMP="$HOME/.mail-sync"
APP_ICON="$(dotfiles_directory)/resources/gmail_logo.png"
SYNC_COMMAND="offlineimap -f INBOX"
function mu4e_alert_for_filename { function mu4e_alert_for_filename {
local message="$(mu view $1 | grep -B 10 Date)" local message="$(mu view $1 | grep -B 10 Date)"
local title="$(echo $message | grep From | sed 's/From: //')" local title="$(echo $message | grep From | sed 's/From: //')"
local subject="$(echo $message | grep Subject | sed 's/Subject: //')" local subject="$(echo $message | grep Subject | sed 's/Subject: //')"
local view_file_command="$(which zsh) -c \"refresh_config && mu4e_view_message_from_file $1\"" local mu4e_message_id="$(mu4e_get_msg_id_from_file $1)"
local view_file_command="$(which zsh) -c \"refresh_config && mu4e_view_message $mu4e_message_id\""
local app_icon_argument=''
test -e "$APP_ICON" && app_icon_argument="-appIcon '$APP_ICON'"
reattach-to-user-namespace $(which terminal-notifier) \ reattach-to-user-namespace $(which terminal-notifier) \
-title "$title" \ -title "$title" \
-message "$subject" \ -message "$subject" \
-execute "$view_file_command" \ -execute "$view_file_command" \
-activate "org.gnu.Emacs" \ -activate "org.gnu.Emacs" \
-appIcon "$(dotfiles_directory)/resources/gmail_logo.png" $app_icon_argument
} }
function mu4e_update_mail { function mu4e_update_mail {
offlineimap eval $SYNC_COMMAND
mu4e_update_index mu4e_update_index
mu4e_alerts mu4e_alerts
} }
@ -34,7 +39,7 @@ function mu4e_alerts {
} }
function mu4e_get_msg_id_from_file { function mu4e_get_msg_id_from_file {
mu view $1 -o sexp | grep "message-id" | get_cols ' -1' mu view $1 -o sexp | grep "message-id" | get_cols ' -1' | sed 's/"//g'
} }
function mu4e_view_message_from_file { function mu4e_view_message_from_file {
@ -42,6 +47,5 @@ function mu4e_view_message_from_file {
} }
function mu4e_view_message { function mu4e_view_message {
local elisp="(mu4e-view-message-with-msgid "$1")" execute_elisp "(mu4e-view-message-with-msgid \"$1\")"
execute_elisp "$elisp"
} }

View File

@ -8,7 +8,7 @@
<array> <array>
<string>zsh</string> <string>zsh</string>
<string>-c</string> <string>-c</string>
<string>python ~/.lib/python/wifi_auto_switch.py -n 4160CesarChavez fake-password -n InternationalFoolery5 fake-password</string> <string>refresh_config && mu4e_update_mail</string>
</array> </array>
<key>KeepAlive</key> <key>KeepAlive</key>
<true/> <true/>

View File

@ -136,6 +136,13 @@ def cl_tools(ctx):
ctx.run('xcode-select --install') ctx.run('xcode-select --install')
@ctask
def fix_htop(ctx):
real_htop_location = ctx.run("readlink -f $(brew --prefix htop)").stdout.strip() + "/bin/htop"
ctx.run("chmod 6555 {0}".format(real_htop_location))
ctx.run("sudo chown root {0}".format(real_htop_location))
@ctask @ctask
def iTerm(ctx): def iTerm(ctx):
library_plist = os.path.join(os.path.expanduser("~"), "Library", library_plist = os.path.join(os.path.expanduser("~"), "Library",