Go to file
2021-03-11 15:50:47 +00:00
examples Add documentation 2021-03-11 05:58:49 +01:00
COPYING Add documentation 2021-03-11 05:58:49 +01:00
org-clock-waybar.el Add more config options and a tooltip 2021-03-11 15:50:47 +00:00
README.md Add more config options and a tooltip 2021-03-11 15:50:47 +00:00

org-clock-waybar Export the currently clocked-in task to be displayed on Waybar

Installation

Put org-clock-waybar.el somewhere in your load-path, and (require 'org-clock-waybar).

MELPA version may come soon.

You can set the file to be written by customizing org-clock-waybar-filename; it defaults to $XDG_CACHE_HOME/waybar-current-task.json ($XDG_CACHE_HOME defaults to $HOME/.cache on XDG compatible systems, like Linux.)

Waybar configuration

To add the current task to Waybar, add this snippet to your config:

"custom/org": {
  "format": " {}",
  "return-type": "json",
  "restart-interval": 5,
  "exec": "cat /home/yourusername/.cache/waybar-current-task.json"
}

You can also display an icon specific to the clocked tasks category with the format-icons key:

"custom/org": {
    "format": "{icon} {}",
    "return-type": "json",
    "restart-interval": 1,
    "format-icons": {
      "refile": "",
      "ToDo": "",
    },
  "exec": "cat /home/yourusername/.cache/waybar-current-task.json"
}

If you use Emacs as a daemon (e.g. starting it as emacs --daemon or calling (server-start)), you can change the exec command to invoke emacsclient directly. Note that, since Emacsclient cant actually write stuff to the terminal, it will output an Emacs string full of backslashes (see this Emacs SE answer for details); thus, you have to pipe the output through jq fromjson.

If you run emacs in this mode you can also eval commands on click, middle click or scroll.:

"custom/org": {
    "format": "{icon} {}",
    "return-type": "json",
    "restart-interval": 1,
    "format-icons": {
      "refile": "",
      "ToDo": "",
    },
    "exec": "emacsclient --eval '(org-clock-waybar-ouptut-task)' | jq fromjson --unbuffered --compact-output",
    "on-click": "emacsclient --eval '(org-clock-out)'",
    "on-middle-click": "emacsclient --eval '(org-clock-in-last)'",
},

Then, add custom/org to modules-left/modules-center/module-right if your bars configuration. You can find a minimal working configuration in the examples directory.

Customization

To see a list of configurable parts, use M-x customize-group <RET> org-clock-waybar.