Make the "Not clocked in" text customizable
This commit is contained in:
		| @@ -22,3 +22,7 @@ To add the current task to Waybar, add this snippet to your config: | ||||
| ``` | ||||
|  | ||||
| Then, add `custom/org` to `modules-left`/`modules-center`/`module-right` if your bar’s configuration.  You can find a minimal working configuration in the [`examples`](./examples) directory. | ||||
|  | ||||
| ## Customization | ||||
|  | ||||
| To see a list of configurable parts, use `M-x customize-group <RET> org-clock-waybar`. | ||||
|   | ||||
| @@ -52,6 +52,12 @@ | ||||
|   :type 'string | ||||
|   :group 'org-clock-waybar) | ||||
|  | ||||
| (defcustom org-clock-waybar-not-clocked-in-text | ||||
|   "Not clocked in" | ||||
|   "Text to display when not clocked in on any task." | ||||
|   :type 'string | ||||
|   :group 'org-clock-waybar) | ||||
|  | ||||
| (defconst org-clock-waybar-filename-coding-system | ||||
|   (if (coding-system-p 'utf-8-emacs) | ||||
|       'utf-8-emacs | ||||
| @@ -62,15 +68,20 @@ | ||||
|   "Save the currently clocked-in task’s data to BUFFER. | ||||
|  | ||||
| The output is in JSON format constructed in a way so Waybar can process it. | ||||
| If there is no clocked in task, alt becomes empty and text will be set to | ||||
| 'Not clocked in'." | ||||
| If there is no clocked in task, alt becomes empty and text will be set to the | ||||
| value of `org-clock-waybar-not-clocked-in-text'." | ||||
|   (let ((category (when org-clock-current-task | ||||
|                     (get-text-property 0 'org-category org-clock-current-task))) | ||||
|         (title (when org-clock-current-task | ||||
|                  (substring-no-properties org-clock-current-task))) | ||||
|         (output (json-new-object))) | ||||
|     (with-current-buffer buffer | ||||
|       (setq output (json-add-to-object output "text" (if title title "Not clocked in"))) | ||||
|       (setq output (json-add-to-object | ||||
|                     output | ||||
|                     "text" | ||||
|                     (if title | ||||
|                         title | ||||
|                       org-clock-waybar-not-clocked-in-text))) | ||||
|       (setq output (json-add-to-object output "alt" (if category category ""))) | ||||
|       (setq output (json-add-to-object output "tooltip" "")) | ||||
|       (setq output (json-add-to-object output "class" "")) | ||||
|   | ||||
		Reference in New Issue
	
	Block a user