From f90fee167febbc5a896812a59698317c1964b01a Mon Sep 17 00:00:00 2001 From: Gergely Polonkai Date: Fri, 12 Mar 2021 05:43:05 +0100 Subject: [PATCH] Get the tags of the currently clocked-in task and expose it in the class key --- org-clock-waybar.el | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/org-clock-waybar.el b/org-clock-waybar.el index d3a0c32..3d4eda0 100644 --- a/org-clock-waybar.el +++ b/org-clock-waybar.el @@ -81,6 +81,13 @@ (org-clock-waybar--get-task-title) (org-duration-from-minutes clocked-time))))) +(defun org-clock-waybar--get-tags () + "Get the tags of the currently clocked-in task." + (when (org-clocking-p) + (save-window-excursion + (org-clock-goto) + (org-get-tags)))) + (defun org-clock-waybar--get-clocked-task-json () "Get the currently clocked-in task’s data as a stringified JSON object. @@ -97,7 +104,7 @@ value of `org-clock-waybar-not-clocked-in-text'." (or title org-clock-waybar-not-clocked-in-text))) (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" "")) + (setq output (json-add-to-object output "class" (or (org-clock-waybar--get-tags) ""))) (setq output (json-add-to-object output "percentage" "")) (json-encode output)))