Skip to content

Instantly share code, notes, and snippets.

@mgkennard
Created March 1, 2018 14:51
Show Gist options
  • Star 4 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save mgkennard/96fbac4140a77bfe3cbf5ad97f93272d to your computer and use it in GitHub Desktop.
Save mgkennard/96fbac4140a77bfe3cbf5ad97f93272d to your computer and use it in GitHub Desktop.
BitBar plugin to display today's Org-mode agenda
#!/usr/bin/env bash
# <bitbar.title>Agenda</bitbar.title>
# <bitbar.version>v1.0</bitbar.version>
# <bitbar.author>Matthew Kennard</bitbar.author>
# <bitbar.author.github>mgkennard</bitbar.author.github>
# <bitbar.desc>Shows the Org-mode agenda</bitbar.desc>
# <bitbar.dependencies>bash</bitbar.dependencies>
echo "Today"
echo "---"
echo "|dropdown=false"
echo "---"
echo "Refresh|refresh=true"
echo "---"
line_index=0
had_timed_entries=false
/usr/local/bin/emacs -batch -l ~/.emacs.d/init.el -eval '(org-batch-agenda "a" org-agenda-span (quote day))' 2>/dev/null | while read line ; do
if [[ $line_index -gt 1 ]] && [[ ! $line = *"---" ]] && [[ ! $line = *"- - -"* ]] ; then
if [[ $line = *"..."* ]] ; then
had_timed_entries=true
elif [[ $had_timed_entries = true ]] ; then
echo "---"
had_timed_entries=false
fi
if [[ $line = *"TODO "* ]] ; then
font="Menlo-Bold"
else
font="Menlo-Regular"
fi
if [[ $line = *"DONE "* ]] || [[ $line = *"CANCELLED "* ]] ; then
color="gray"
elif [[ $line = *"x: "* ]] ; then
color="red"
else
color="black"
fi
echo "$line | font=$font size=14 color=$color trim-false"
fi
line_index=$((line_index+1))
done
@mankoff
Copy link

mankoff commented Mar 4, 2018

It's emacs and Org-mode so "Today" should be replaced by 🦄

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment