1

count down timer This code starts a count down timer every time org file is opened , but asks for a permission to reset timer every time . Can it be automated, meaning it should start counting as soon as org file is opened. Second, it should show a pop up when time is up. Can you please help

Vaibhav
  • 573
  • 3
  • 15
  • for the popup part: if you are on linux, you can use `notify-send`. also i'm curious: why u need a timer for org-files? – kai-dj Jun 23 '18 at 17:53
  • To limit the interaction time so that I can follow the schedule. I am on windows – Vaibhav Jun 23 '18 at 18:07

1 Answers1

2

I can't help with the pop up but, in place of that, I suggest that you use a bell sound.

You should have a wav sound file for this and you could use a bell sound like org-pomodoro's.

From C-h f org-timer-set-timer (org-timer-set-timer function help):

With two ‘C-u’ prefix arguments, use ‘org-timer-default-timer’ without prompting the user for a duration and automatically replace any running timer.

To emulate C-u:

(let ((current-prefix-arg '(4))) ... ) emulates C-u

(let ((current-prefix-arg '(16))) ... ) emulates C-u C-u

Putting the following in your init file should do the trick:

(setq org-clock-sound "/path/to/sound.wav") ; set `org-clock-sound'
;; set default org-timer to 10 minutes (for X minutes and Y seconds, use "X:Y")
(setq org-timer-default-timer "10")
(add-hook 'org-mode-hook
          (lambda ()
            (interactive)
            (let ((current-prefix-arg '(16)))
              (call-interactively 'org-timer-set-timer))))

Don't forget to change "/path/to/sound.wav" to the real path.

Drew
  • 75,699
  • 9
  • 109
  • 225
adl
  • 636
  • 3
  • 6