From 44e6818abb0be1947bc6df0243d36ab906d3559d Mon Sep 17 00:00:00 2001 From: Daniel Borchmann Date: Sat, 31 Aug 2019 11:26:04 +0200 Subject: [PATCH] [Org] Provide function to set frame title from current clock --- init.el | 2 ++ site-lisp/db-org.el | 10 +++++++++- 2 files changed, 11 insertions(+), 1 deletion(-) diff --git a/init.el b/init.el index 749109e..7d4ced3 100644 --- a/init.el +++ b/init.el @@ -643,6 +643,7 @@ search commands like `db/helm-shortcuts’." db/find-parent-task db/ensure-running-clock db/save-current-org-task-to-file + db/org-update-frame-title-with-current-clock db/org-clock-out db/org-clock-in-break-task db/org-clock-in-home-task @@ -885,6 +886,7 @@ search commands like `db/helm-shortcuts’." (org-clock-persistence-insinuate) (add-hook 'org-clock-in-hook #'db/org-mark-current-default-task) + (add-hook 'org-clock-in-hook #'db/org-update-frame-title-with-current-clock) ;; Clock in default task if no other task is given (add-hook 'org-clock-out-hook #'db/ensure-running-clock 'append) diff --git a/site-lisp/db-org.el b/site-lisp/db-org.el index b0f0da0..db47909 100644 --- a/site-lisp/db-org.el +++ b/site-lisp/db-org.el @@ -262,7 +262,7 @@ In ~%s~: (org-reset-checkbox-state-subtree))) -;; Helper Functions for Clocking +;;; Helper Functions for Clocking (defun db/find-parent-task () ;; http://doc.norang.ca/org-mode.html#Clocking @@ -308,6 +308,14 @@ In ~%s~: (insert "No running clock") (insert org-clock-heading))))) +(defun db/org-update-frame-title-with-current-clock () + "Set the frametitle of the current frame to the headline of the + current task." + (interactive) + (let ((clock-buffer (marker-buffer org-clock-marker))) + (when clock-buffer + (modify-frame-parameters nil `((name . , org-clock-heading)))))) + ;;; Fixes