From 1dafd1306e537a20074384f67476622f4d3bf402 Mon Sep 17 00:00:00 2001 From: Gergely Polonkai Date: Fri, 12 Mar 2021 17:18:43 +0100 Subject: [PATCH] Factor out clocked-out title generation to get-task-title --- org-clock-waybar.el | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/org-clock-waybar.el b/org-clock-waybar.el index 3ad7910..93d7f12 100644 --- a/org-clock-waybar.el +++ b/org-clock-waybar.el @@ -66,7 +66,9 @@ (defsubst org-clock-waybar-get-task-title () "Get the title of TASK." - (when (org-clocking-p) (substring-no-properties org-clock-current-task))) + (if (org-clocking-p) + (substring-no-properties org-clock-current-task) + org-clock-waybar-not-clocked-in-text)) (defsubst org-clock-waybar-get-task-category () "Get the category of TASK." @@ -99,10 +101,7 @@ value of `org-clock-waybar-not-clocked-in-text'." (tooltip (org-clock-waybar-get-tooltip)) (class (org-clock-waybar-get-tags)) (output (json-new-object))) - (setq output (json-add-to-object - output - "text" - (or title org-clock-waybar-not-clocked-in-text))) + (setq output (json-add-to-object output "text" (or title ""))) (setq output (json-add-to-object output "alt" (or category ""))) (setq output (json-add-to-object output "tooltip" (or tooltip ""))) (setq output (json-add-to-object output "class" (or class "")))