[Request] Prompt for new pomodoro after break
alienbogart opened this issue ยท 11 comments
It would be nice to get a prompt to start a new pomodoro after breaks. Thanks!
Is there any functionality activating another pomodoro after either break automatically yet? I can not seem to find it, if it exists.
Add a hook to org-pomodoro-break-finished-hook
?
I know this is not the sapce to ask something like this, but I am new to emacs/lisp. So the obvious question is, how would one do that?
I think this should do it:
(add-hook 'org-pomodoro-break-finished-hook #'org-pomodoro)
This will start a pomodoro immediately after both a short and a long break. If you want it to run after just a short break, it's a little more complicated.
It works!
Although the new clock-in happens under the task where the cursor is located, once the new timer is started.
So one would have to jump to the current clocking task before this created "hook-timer" starts.
Ah, yes, then you need something like this:
(defun my/org-pomodoro-resume-after-break ()
"Resume Org Pomodoro after break is finished."
(org-clock-goto)
(org-pomodoro))
(add-hook 'org-pomodoro-break-finished-hook #'my/org-pomodoro-resume-after-break)
So, I tried your last suggestion, and it works smoothly. Thank you again!
(add-hook 'org-pomodoro-break-finished-hook #'org-pomodoro)
This will start a pomodoro immediately after both a short and a long break. If you want it to run after just a short break, it's a little more complicated.
This would immediately start another Pomodoro in the current header. I meant something different: a prompt or dialogue (those with "Yes" or "No") so I can just press "Y" or "Yes" for a new Pomodoro. Ideally, it should go to last Pomodoro automatically. Something like:
(defun org-pomodoro-prompt ()
(interactive)
(org-clock-goto)
(org-prompt-for-pomodoro))
(add-hook 'org-pomodoro-break-finished-hook 'org-pomodoro-prompt)
Thanks!
(add-hook 'org-pomodoro-break-finished-hook #'org-pomodoro)
This will start a pomodoro immediately after both a short and a long break. If you want it to run after just a short break, it's a little more complicated.
This would immediately start another Pomodoro in the current header. I meant something different: a prompt or dialogue (those with "Yes" or "No") so I can just press "Y" or "Yes" for a new Pomodoro. Ideally, it should go to last Pomodoro automatically. Something like:
(defun org-pomodoro-prompt () (interactive) (org-clock-goto) (org-prompt-for-pomodoro)) (add-hook 'org-pomodoro-break-finished-hook 'org-pomodoro-prompt)
Thanks!
Maybe it's not perfect. This works for me.
(defun org-pomodoro-prompt ()
(interactive)
(org-clock-goto)
(if (y-or-n-p "Start a new pomodoro?")
(progn
(org-pomodoro))))
(add-hook 'org-pomodoro-break-finished-hook 'org-pomodoro-prompt)
I would love it if there was a variable in the package itself to allow autostart timer after break.
I just modified the prompt function so now it doesn't switch buffers all of a sudden when your break ends.
(defun my/org-pomodoro-restart ()
(interactive)
(when (y-or-n-p "Start a new pomodoro?")
(save-window-excursion
(org-clock-goto)
(org-pomodoro))))
(add-hook 'org-pomodoro-break-finished-hook 'my/org-pomodoro-restart)
Also, if you want a minibuffer popup instead of a gui one, use the following instead
(defun my/org-pomodoro-restart ()
(interactive)
(let ((use-dialog-box nil))
(when (y-or-n-p "Start a new pomodoro?")
(save-window-excursion
(org-clock-goto)
(org-pomodoro)))))
(add-hook 'org-pomodoro-break-finished-hook 'my/org-pomodoro-restart)