I use Org-Mode to track my work time. While refactoring my Emacs setup to increase my productivity I tried for example to make my Org-Mode setup better. One issue I have is that I tend to forget the things around me, I have trouble tracking time.
To make that easier I wanted to see the time spend on the current task and it’s heading into the frame title.
While searching for solution on my issue I found this post on the org-mode mailing list ow to add the time spend on the current task and it’s heading into the frame title.
I’ve modified it to also include the file modified status in the title and make it look a little better.
To do so we have to modify the Emacs frame title and update it in an given interval.
(defvar base-frame-title-format nil "Like frame-title-format to be used as a base for to modify it by") (setq base-frame-title-format '((:eval (if (buffer-file-name) (abbreviate-file-name (buffer-file-name)) "%b")) (:eval (if (buffer-modified-p) " •")) " — Emacs")) (defun clock-in-frame-title () (if (org-clocking-p) (setq frame-title-format (list base-frame-title-format " — 🕓: " (org-clock-get-clock-string) " — ⟳:" org-timer-mode-line-string)) (setq frame-title-format base-frame-title-format))) (run-at-time t 1 'clock-in-frame-title) (add-hook 'org-clock-in-hook 'clock-in-frame-title) (add-hook 'org-clock-out-hook 'clock-in-frame-title) (add-hook 'org-clock-cancel-hook 'clock-in-frame-title)