Archived
1
0
Fork 0

Compare commits

..

2 commits

View file

@ -360,24 +360,55 @@
; long break is 30 mins ; long break is 30 mins
; every 3rd pomodoro give 30 minute break ; every 3rd pomodoro give 30 minute break
; actual values
(setq pomidor-seconds (* 60 60)) ; total work period (setq pomidor-seconds (* 60 60)) ; total work period
(setq pomidor-warmup-seconds (* 15 60)) ; warmup time (setq pomidor-warmup-seconds (* 15 60)) ; warmup time
(setq pomidor-break-seconds (* 10 60)) (setq pomidor-break-seconds (* 10 60))
(setq pomidor-breaks-before-long 3) (setq pomidor-breaks-before-long 3)
(setq pomidor-long-break-seconds (* 30 60)) (setq pomidor-long-break-seconds (* 30 60))
; setup 'warmup period' functionality ; setup emoji separators to enhance visual state indicators
(defun my-pomidor-update-hook () (defun my-pomidor-separator-hook ()
(let* ((state (pomidor--current-state)) (let* ((state (pomidor--current-state))
(total (pomidor--total-duration state)) (total (pomidor--total-duration state))
(ellapsed (round (time-to-seconds total)))) (elapsed (round (time-to-seconds total))))
(if (<= ellapsed pomidor-warmup-seconds) (cond ; watch out for the order of this conditional
(setq pomidor-header-separator " 🌡️↑ ") ; there are overlapping states and this order is meaninful
(setq pomidor-header-separator "") ((or (pomidor-overwork-p) (pomidor-break-over-p))
(setq pomidor-header-separator " ⚠️ "))
((pomidor-should-long-break-p)
(setq pomidor-header-separator " 🪁 "))
((pomidor--break state)
(setq pomidor-header-separator " 🚶 "))
((<= elapsed pomidor-warmup-seconds)
(setq pomidor-header-separator " 🌡️↑ "))
(t (setq pomidor-header-separator " 🏢 "))
) )
) )
) )
(add-hook 'pomidor-update-hook #'my-pomidor-update-hook) ; add separator logic as std pomidor update hook to ensure the emoji separators get displayed
; this will be delayed up to the pomidor-update-interval for display
(add-hook 'pomidor-update-hook #'my-pomidor-separator-hook)
; trigger the emoji separator for common operations so it 'triggers' faster than via the std pomidor update hook
; this should show the emoji separators 'faster' than relying on just the update hook
(advice-add #'pomidor-reset :after #'my-pomidor-separator-hook)
(advice-add #'pomidor-stop :after #'my-pomidor-separator-hook)
(advice-add #'pomidor-break :after #'my-pomidor-separator-hook)
; 'hold' visual indicator
(defun my-pomidor-hold-separator ()
(interactive)
(setq pomidor-header-separator " 💤 ")
(pomidor--update)
)
(advice-add #'pomidor-hold :before #'my-pomidor-hold-separator)
; 'unhold' -- reset visual indicator
(defun my-pomidor-unhold-separator ()
(interactive)
(my-pomidor-separator-hook)
(pomidor--update)
)
(advice-add #'pomidor-unhold :before #'my-pomidor-unhold-separator)
; position cursor @ top of pomidor buffer after rendering ; position cursor @ top of pomidor buffer after rendering
(defun my-pomidor-beginning-of-buffer (buffer states) (defun my-pomidor-beginning-of-buffer (buffer states)