Get the tags of the currently clocked-in task and expose it in the class key
This commit is contained in:
parent
7648b9629c
commit
f90fee167f
@ -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)))
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user