You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: README.md
+16-9
Original file line number
Diff line number
Diff line change
@@ -4,7 +4,8 @@
4
4
> This used to be a shell script. Now it is a binary.
5
5
> The CLI arguments have changed only slightly but the underlying architecture is completely different.
6
6
> Therefore, if you switch from the shell script version to the binary, please make sure to **fully adapt the new default config**.
7
-
> In particular you need to add `tail` for `exec`, remove `interval`, set `exec-on-event` to false, and change `increase -60` to `decrease 60`.
7
+
> In particular, you need to add `hook` for `exec`, remove `interval`, set `exec-on-event` to false, and change `increase -60` to `decrease 60`.
8
+
> You also need to start a waybar-timer server _before_ you start waybar.
8
9
9
10
This script implements a **simple** and **interactive** timer for your bar:
10
11
- e.g. scroll to increase / decrease timer
@@ -31,14 +32,15 @@ Use cases: pomodoro timer, self-reminder when next meeting begins, tea/pasta tim
31
32
## Installation
32
33
33
34
1. Download the binary from the [releases](https://github.com/jbirnick/waybar-timer/releases) (or build it yourself with cargo) and put it in a directory of your choice (e.g. `~/.scripts/`).
34
-
2. Copy-paste the [example configuration](#example-configuration) from below into your waybar config and style it.
35
-
3. Customize. (see [Customization section](#customization))
35
+
2. In the startup script of your compositor, run `/path/to/waybar_timer serve` and make sure it starts **before waybar starts**.
36
+
3. Copy-paste the [example configuration](#example-configuration) from below into your waybar config and style it.
37
+
4. Customize. (see [Customization section](#customization))
36
38
37
39
## Example Configuration
38
40
39
41
```json
40
42
"custom/timer": {
41
-
"exec": "/path/to/waybar_timer tail",
43
+
"exec": "/path/to/waybar_timer hook",
42
44
"exec-on-event": false,
43
45
"return-type": "json",
44
46
"format": "{icon} {0}",
@@ -78,12 +80,17 @@ If you need a specific functionality feel free to open an issue and maybe we can
78
80
79
81
Notation: `<...>` are necessary arguments and `[...]` are optional arguments.
80
82
81
-
The main command of the script is:
83
+
The main commands of the script are :
82
84
83
-
-#### `tail`
85
+
-#### `serve`
86
+
This is the command you want to put in the startup script of your compositor.
87
+
Make sure you start this server _before_ you start waybar.
88
+
It keeps the state of the timer and provides updates to all the clients who call `hook`.
89
+
90
+
-#### `hook`
84
91
This is the command which you want to put in your waybar `exec` field.
85
-
It keeps the state of the timer and regularly outputs it in JSON, so that waybar can render it.
86
-
We will call the process which runs this `tail` routine the *tail process*.
92
+
It subscribes to the server to get all the updates of the timer.
93
+
Updates are delivered as JSON which is readable by waybar.
87
94
88
95
Now the following commands allow you to control the timer.
89
96
@@ -112,6 +119,6 @@ You can implement this because `increase` will exit with code 1 when there is no
112
119
```
113
120
waybar-timer increase 60 || waybar-timer new 1 'notify-send "Timer expired."'
114
121
```
115
-
Then if there is an existing timer it gets increased, otherwise a new one minute timer is created.
122
+
Then, if there is an existing timer it gets increased, otherwise a new one minute timer is created.
116
123
This is also implemented in the [example configuration](#example-configuration).
117
124
Just try to scroll up when there is no timer running!
0 commit comments