TatriX / pomidor

Pomidor is a simple and cool pomodoro technique timer.
239 stars 17 forks source link

Additional Tip/Trick For Wiki? #58

Open mcrosson opened 3 weeks ago

mcrosson commented 3 weeks ago

(Ticket opened because GitHub doesn't seem to allow Pull Requests for wiki's)

The below is and update I put togther to help with visual indicators when notification and sound are disabled. I think the below could be added as an additional section to the wiki as the current, similar example is a bit easier to follow/understand. I'd propose adding the below as a section below Warmup interval

Proposed wiki text/section:

More complete emoji for states and visual indication

After using pomidor for awhile I made some additional enhancements to my config related to using the time separator as an additional visual cue. I have notifications and sounds turned off so I went ahead and used the custom separator to indicate the different states that can happen with pomidor.

; setup emoji separators to enhance visual state indicators
(defun my-pomidor-separator-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 meaningful
            ((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 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 'activates' 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)