From 15e12f06b5077570cfae64694f80ac0aa935c551 Mon Sep 17 00:00:00 2001 From: Ivan Malison Date: Sat, 20 Dec 2014 01:23:42 -0800 Subject: [PATCH] tweak mu4e syncing. --- dotfiles/lib/shellrc/mu4e.sh | 24 +++++++++++-------- resources/org.imalison.wifi-auto-switch.plist | 2 +- tasks/osx.py | 7 ++++++ 3 files changed, 22 insertions(+), 11 deletions(-) diff --git a/dotfiles/lib/shellrc/mu4e.sh b/dotfiles/lib/shellrc/mu4e.sh index 8eece1d3..ddeaa2bf 100644 --- a/dotfiles/lib/shellrc/mu4e.sh +++ b/dotfiles/lib/shellrc/mu4e.sh @@ -1,21 +1,26 @@ MAILDIR="$HOME/Mail" SYNC_STAMP="$HOME/.mail-sync" +APP_ICON="$(dotfiles_directory)/resources/gmail_logo.png" +SYNC_COMMAND="offlineimap -f INBOX" function mu4e_alert_for_filename { local message="$(mu view $1 | grep -B 10 Date)" local title="$(echo $message | grep From | sed 's/From: //')" 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) \ - -title "$title" \ - -message "$subject" \ - -execute "$view_file_command" \ - -activate "org.gnu.Emacs" \ - -appIcon "$(dotfiles_directory)/resources/gmail_logo.png" + -title "$title" \ + -message "$subject" \ + -execute "$view_file_command" \ + -activate "org.gnu.Emacs" \ + $app_icon_argument } function mu4e_update_mail { - offlineimap + eval $SYNC_COMMAND mu4e_update_index mu4e_alerts } @@ -34,7 +39,7 @@ function mu4e_alerts { } 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 { @@ -42,6 +47,5 @@ function mu4e_view_message_from_file { } function mu4e_view_message { - local elisp="(mu4e-view-message-with-msgid "$1")" - execute_elisp "$elisp" + execute_elisp "(mu4e-view-message-with-msgid \"$1\")" } diff --git a/resources/org.imalison.wifi-auto-switch.plist b/resources/org.imalison.wifi-auto-switch.plist index 850134f8..9fb5f7de 100644 --- a/resources/org.imalison.wifi-auto-switch.plist +++ b/resources/org.imalison.wifi-auto-switch.plist @@ -8,7 +8,7 @@ zsh -c - python ~/.lib/python/wifi_auto_switch.py -n 4160CesarChavez fake-password -n InternationalFoolery5 fake-password + refresh_config && mu4e_update_mail KeepAlive diff --git a/tasks/osx.py b/tasks/osx.py index 7eca89f7..7b5272a0 100644 --- a/tasks/osx.py +++ b/tasks/osx.py @@ -136,6 +136,13 @@ def cl_tools(ctx): 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 def iTerm(ctx): library_plist = os.path.join(os.path.expanduser("~"), "Library",