yqrashawn / bitbar-plugin-agenda

display org-agenda in bitbar(menu bar)
http://yqrashawn.com/2017/11/25/org-agenda-bitbar-plugin
3 stars 0 forks source link
agenda bitbar emacs macos menubar org osx

[[https://github.com/matryer/bitbar][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, [[https://github.com/yqrashawn/bitbar-plugin-agenda][agenda]] to display some of my agenda in menu bar.


*** feature

Like this.

[[file:bitbar-ext-org-agenda.png]]

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

I'm using emacs [[https://www.emacswiki.org/emacs/BatchMode][--batch]] feature to generate the txt file silently. There may better way for doing this, like ~org-batch-agenda~ ([[http://orgmode.org/manual/Extracting-agenda-information.html][check 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.

+BEGIN_SRC shell

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))'

+END_SRC

Note: for [[https://github.com/syl20bnr/spacemacs][spacemacs]] user, you need to add ~(run-hooks 'emacs-startup-hook)~ to let emacs read your ~dotspacemacs/user-config~ ([[https://github.com/syl20bnr/spacemacs/issues/4504][issue#4504]]).

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

+BEGIN_SRC ruby

Change to your todo directory path

agenda_directory = "#{Dir.home}/agendas/work/" agenda_name = 'todos.txt'

+END_SRC

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)~.

+BEGIN_SRC ruby

the agenda custome command which brings the agenda view that you want to export

agenda_custome_command = 'B'

+END_SRC

The problem of using ~--batch~ is to [[https://emacs.stackexchange.com/questions/5451/how-do-i-force-kill-emacs/5456][really kill emacs]].

+BEGIN_SRC ruby

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))'

+END_SRC

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

+BEGIN_SRC ruby

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' }

+END_SRC

If you use pacakges that will change filters' format in agenda view, you need to specify ~tag_indicator~ .

+BEGIN_SRC ruby

tag_indicator = 'Headlines with TAGS match: '

+END_SRC

*** limitation

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

+BEGIN_SRC lisp

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

+END_SRC