Make the "Not clocked in" text customizable
This commit is contained in:
parent
d3d80e6e38
commit
5d97d022c7
@ -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.
|
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
|
:type 'string
|
||||||
:group 'org-clock-waybar)
|
: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
|
(defconst org-clock-waybar-filename-coding-system
|
||||||
(if (coding-system-p 'utf-8-emacs)
|
(if (coding-system-p 'utf-8-emacs)
|
||||||
'utf-8-emacs
|
'utf-8-emacs
|
||||||
@ -62,15 +68,20 @@
|
|||||||
"Save the currently clocked-in task’s data to BUFFER.
|
"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.
|
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
|
If there is no clocked in task, alt becomes empty and text will be set to the
|
||||||
'Not clocked in'."
|
value of `org-clock-waybar-not-clocked-in-text'."
|
||||||
(let ((category (when org-clock-current-task
|
(let ((category (when org-clock-current-task
|
||||||
(get-text-property 0 'org-category org-clock-current-task)))
|
(get-text-property 0 'org-category org-clock-current-task)))
|
||||||
(title (when org-clock-current-task
|
(title (when org-clock-current-task
|
||||||
(substring-no-properties org-clock-current-task)))
|
(substring-no-properties org-clock-current-task)))
|
||||||
(output (json-new-object)))
|
(output (json-new-object)))
|
||||||
(with-current-buffer buffer
|
(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 "alt" (if category category "")))
|
||||||
(setq output (json-add-to-object output "tooltip" ""))
|
(setq output (json-add-to-object output "tooltip" ""))
|
||||||
(setq output (json-add-to-object output "class" ""))
|
(setq output (json-add-to-object output "class" ""))
|
||||||
|
Loading…
Reference in New Issue
Block a user