Get the tags of the currently clocked-in task and expose it in the class key

This commit is contained in:
Gergely Polonkai 2021-03-12 05:43:05 +01:00
parent 7648b9629c
commit f90fee167f
No known key found for this signature in database
GPG Key ID: 2D2885533B869ED4

View File

@ -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 tasks 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)))