November 25, 2017

Org Agenda Bitbar Plugin

UPDATE: The agenda plugin has been merged into the official plugin repo. You can now find the plugin here.

Bitbar is a macOS application that can add custom menu bar buttons. I’m recently learning managing projects with org-mode. And we all know that org-agenda is great.

So I write a bitbar plugin, agenda to display some of my agenda in menu bar.


Feature

It can display your chosen org-agenda-custom-commands in menu bar. Support customize color for priority. Support different color for filter. Make item with links clickable(only support http/https url).

Like this.

img

Usage

User need to specify the command to export the agenda-view to txt file.

I’m using emacs –batch feature to generate the txt file silently. There may better way for doing this, like org-batch-agenda check it out here. But when my emacs configuration piles up, there’s lots of initializing message which makes it hard to extract the agenda-view data. So I just use the org-agenda-write command to write agenda-view to disk.

emacs --batch -l ~/.emacs.d/init.el --eval "(run-hooks 'emacs-startup-hook)" \
      --eval '(progn (org-agenda nil "r") (org-agenda-write "~/agendas/work/todos.txt") (spacemacs/kill-emacs))'

Note: for spacemacs user, you need to add (run-hooks 'emacs-startup-hook) to let emacs read your dotspacemacs/user-config issue#4504. Or you can extract your org-agenda configuration into a separate file and --eval it alone.

For using this plugin. You need to specify agenda_directory agenda_file_name.

# Change to your todo directory path
agenda_directory = "#{Dir.home}/agendas/work/"
agenda_name = 'todos.txt'

And also the agenda custom command key, you may in your configuration file, you can find your setting using (describe-variable 'org-agenda-custom-commands).

# the agenda custome command which brings the agenda view that you want to export
agenda_custome_command = 'B'

The problem of using --batch is to really kill emacs.

# function to REALLY kill emacs
# for spacemacs user use (spacemacs/kill-emacs)
# kill_emacs_function = '(spacemacs/kill-emacs)'
kill_emacs_function = '(let (kill-emacs-hook) (kill-emacs))'

You can also change colors of filter line and lines with priority.

# Change priority color here
tag_color = 'orange'

# Customise label color-code here (these colors are optimised for a dark theme menubar)
labels = {
  '[#A]' => 'red',
  '[#B]' => 'yellow',
  '[#C]' => 'violet'
}

If you use packages that will change filters’ format in agenda view, you need to specify tag_indicator .

tag_indicator = 'Headlines with TAGS match: '

Limitation

Current version don’t support agenda-view when you add, say you add the below code in the chosen org-agenda-custom-commands.

(agenda ((org-agenda-ndays 7)))

November 25, 2017 agenda org-mode emacs



Previous post
Use Zsh in Emacs
Next post
Emacs Workspace Management