add additional emoji separators to enhance visual indicators for different pomidor states
This commit is contained in:
parent
562385cb8e
commit
f286c663b0
45
org/init.el
45
org/init.el
|
@ -360,24 +360,55 @@
|
|||
; 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 'warmup period' functionality
|
||||
(defun my-pomidor-update-hook ()
|
||||
; setup emoji separators to enhance visual state indicators
|
||||
(defun my-pomidor-separator-hook ()
|
||||
(let* ((state (pomidor--current-state))
|
||||
(total (pomidor--total-duration state))
|
||||
(ellapsed (round (time-to-seconds total))))
|
||||
(if (<= ellapsed pomidor-warmup-seconds)
|
||||
(setq pomidor-header-separator " 🌡️↑ ")
|
||||
(setq pomidor-header-separator " — ")
|
||||
(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 " 🏢 "))
|
||||
)
|
||||
)
|
||||
)
|
||||
(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
|
||||
(defun my-pomidor-beginning-of-buffer (buffer states)
|
||||
|
|
Reference in a new issue