Archived
1
0
Fork 0

Compare commits

..

No commits in common. "0c7b4a637388778743c676f08787fb44b2420368" and "db916a23d2f180bd98dc7151890fa07c1e9771b5" have entirely different histories.

View file

@ -360,55 +360,24 @@
; long break is 30 mins
; every 3rd pomodoro give 30 minute break
; actual values
(setq pomidor-seconds (* 60 60)) ; total work period
(setq pomidor-warmup-seconds (* 15 60)) ; warmup time
(setq pomidor-break-seconds (* 10 60))
(setq pomidor-breaks-before-long 3)
(setq pomidor-long-break-seconds (* 30 60))
; setup emoji separators to enhance visual state indicators
(defun my-pomidor-separator-hook ()
; setup 'warmup period' functionality
(defun my-pomidor-update-hook ()
(let* ((state (pomidor--current-state))
(total (pomidor--total-duration state))
(elapsed (round (time-to-seconds total))))
(cond ; watch out for the order of this conditional
; there are overlapping states and this order is meaninful
((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 " 🏢 "))
(ellapsed (round (time-to-seconds total))))
(if (<= ellapsed pomidor-warmup-seconds)
(setq pomidor-header-separator " 🌡️↑ ")
(setq pomidor-header-separator "")
)
)
)
; 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)
(add-hook 'pomidor-update-hook #'my-pomidor-update-hook)
; position cursor @ top of pomidor buffer after rendering
(defun my-pomidor-beginning-of-buffer (buffer states)