A bash script for catching when the server is offline

This commit is contained in:
Stuart Mumford 2021-03-11 11:22:45 +00:00
parent 92f896af05
commit bc61218f92
No known key found for this signature in database
GPG Key ID: 60BC5C03E6276769
1 changed files with 15 additions and 3 deletions

View File

@ -23,6 +23,12 @@ 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 bars
configuration. You can find a minimal working configuration in the [`examples`](./examples)
directory.
### Additional Configuration
You can also display an icon specific to the clocked tasks category with the `format-icons` key:
```json
@ -62,9 +68,15 @@ If you run emacs in this mode you can also eval commands on click, middle click
```
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`](./examples)
directory.
If you want the taskbar to show nothing or some other content if the emacs server is not running then you need to write a short bash script to catch when the emacsclient command returns a non-zero exit code. An example of this is:
```bash
#!/bin/bash
json=$(emacsclient --eval '(org-clock-waybar-ouptut-task)' 2> /dev/null)
status=$?
[ $status -eq 0 ] && echo $(echo $json | jq fromjson --unbuffered --compact-output) || echo ""
```
## Customization