tea-time.elでポモドーロ(ついでにgrowlで通知するようにした)
ポモドーロをやりたいが、あたらしい職場でまだキッチンタイマーの音を鳴らす勇気がないので、emacsのタイマーを探してみた。
そしたらtea-time.el*1というのがあって、見てみるとこれがちょうど良さそうなので使ってみる。
インストール
M-x auto-install-from-url https://raw.github.com/krick/tea-time/master/tea-time.el
して、.emacs等に
(require 'tea-time) (setq tea-time-sound "path-to-sound-file") (setq tea-time-sound-command "afplay %s")
を貼付ける。
以上。
使い方
M-x tea-time
すると「How long? (min)」って聞かれるので、セットしたい時間を入力する。
あとは時間が来るとミニバッファに通知してくれる。
growlで
でも、ミニバッファの通知は控えめすぎてこれじゃ気づけないかもしれない、、ということでgrowlで通知するようにしてみた。
growlやgrowlnotifyがもしインストールされていなければ、ここ*2からインストールしておく。
で、適当にgrowl通知用の関数をでっち上げる。一応priorityとstickyにも対応しておいた。
(defun my-growl-notification (title message &optional priority sticky) "" (shell-command (format (concat "growlnotify -t \"%s\" -m \"%s\"" (if priority (concat " -p " (number-to-string priority)) "") (if sticky " -s ")) title message)))
次に、ちょっと手抜きしてtea-time.elのtea-timer関数を書き換える。
(defun tea-timer (sec) "Ding and show notification when tea is ready. Store current timer in a global variable." (interactive) (run-at-time sec nil (lambda (seconds) (tea-time-play-sound) ;; (tea-time-show-notification (format "Time is up! %d minutes" (/ seconds 60))) (my-growl-notification "tea-time.el" (format "Time is up! %d minutes" (/ seconds 60))) ; 上の行をコメントアウトして、この行を追加した ) sec))